1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h"
12 #include "chrome/browser/chromeos/settings/cros_settings.h"
13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
14 #include "ui/gfx/point.h"
20 // WebUI implementation of NetworkScreenActor. It is used to interact with
21 // the welcome screen (part of the page) of the OOBE.
22 class NetworkScreenHandler
: public NetworkScreenActor
,
23 public BaseScreenHandler
{
25 explicit NetworkScreenHandler(CoreOobeActor
* core_oobe_actor
);
26 virtual ~NetworkScreenHandler();
28 // NetworkScreenActor implementation:
29 virtual void SetDelegate(NetworkScreenActor::Delegate
* screen
) OVERRIDE
;
30 virtual void PrepareToShow() OVERRIDE
;
31 virtual void Show() OVERRIDE
;
32 virtual void Hide() OVERRIDE
;
33 virtual void ShowError(const string16
& message
) OVERRIDE
;
34 virtual void ClearErrors() OVERRIDE
;
35 virtual void ShowConnectingStatus(bool connecting
,
36 const string16
& network_id
) OVERRIDE
;
37 virtual void EnableContinue(bool enabled
) OVERRIDE
;
39 // BaseScreenHandler implementation:
40 virtual void DeclareLocalizedValues(LocalizedValuesBuilder
* builder
) OVERRIDE
;
41 virtual void GetAdditionalParameters(base::DictionaryValue
* dict
) OVERRIDE
;
42 virtual void Initialize() OVERRIDE
;
44 // WebUIMessageHandler implementation:
45 virtual void RegisterMessages() OVERRIDE
;
48 // Handles moving off the screen.
51 // Handles change of the language.
52 void HandleOnLanguageChanged(const std::string
& locale
);
54 // Handles change of the input method.
55 void HandleOnInputMethodChanged(const std::string
& id
);
57 // Handles change of the time zone
58 void HandleOnTimezoneChanged(const std::string
& timezone
);
60 // Callback when the system timezone settings is changed.
61 void OnSystemTimezoneChanged();
63 // Returns available languages. Caller gets the ownership. Note, it does
64 // depend on the current locale.
65 static base::ListValue
* GetLanguageList();
67 // Returns available input methods. Caller gets the ownership. Note, it does
68 // depend on the current locale.
69 static base::ListValue
* GetInputMethods();
71 // Returns available timezones. Caller gets the ownership.
72 static base::ListValue
* GetTimezoneList();
74 NetworkScreenActor::Delegate
* screen_
;
75 CoreOobeActor
* core_oobe_actor_
;
77 bool is_continue_enabled_
;
79 // Keeps whether screen should be shown right after initialization.
82 // Position of the network control.
83 gfx::Point network_control_pos_
;
85 scoped_ptr
<CrosSettings::ObserverSubscription
> timezone_subscription_
;
87 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler
);
90 } // namespace chromeos
92 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_