Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / network_screen_handler.h
blob56cb8a2ba3716482e5f6bf07d7fb96b79d7ba134
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_
8 #include <string>
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"
16 namespace chromeos {
18 class CoreOobeActor;
20 struct NetworkScreenHandlerOnLanguageChangedCallbackData;
22 // WebUI implementation of NetworkScreenActor. It is used to interact with
23 // the welcome screen (part of the page) of the OOBE.
24 class NetworkScreenHandler : public NetworkScreenActor,
25 public BaseScreenHandler {
26 public:
27 explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor);
28 virtual ~NetworkScreenHandler();
30 // NetworkScreenActor implementation:
31 virtual void SetDelegate(NetworkScreenActor::Delegate* screen) OVERRIDE;
32 virtual void PrepareToShow() OVERRIDE;
33 virtual void Show() OVERRIDE;
34 virtual void Hide() OVERRIDE;
35 virtual void ShowError(const base::string16& message) OVERRIDE;
36 virtual void ClearErrors() OVERRIDE;
37 virtual void ShowConnectingStatus(bool connecting,
38 const base::string16& network_id) OVERRIDE;
39 virtual void EnableContinue(bool enabled) OVERRIDE;
41 // BaseScreenHandler implementation:
42 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
43 virtual void GetAdditionalParameters(base::DictionaryValue* dict) OVERRIDE;
44 virtual void Initialize() OVERRIDE;
46 // WebUIMessageHandler implementation:
47 virtual void RegisterMessages() OVERRIDE;
49 private:
50 // Handles moving off the screen.
51 void HandleOnExit();
53 // Handles change of the language.
54 void HandleOnLanguageChanged(const std::string& locale);
56 // Async callback after ReloadResourceBundle(locale) completed.
57 static void OnLanguageChangedCallback(
58 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context,
59 const std::string& requested_locale,
60 const std::string& loaded_locale,
61 const bool success);
63 // Handles change of the input method.
64 void HandleOnInputMethodChanged(const std::string& id);
66 // Handles change of the time zone
67 void HandleOnTimezoneChanged(const std::string& timezone);
69 // Callback when the system timezone settings is changed.
70 void OnSystemTimezoneChanged();
72 // Returns available languages. Caller gets the ownership. Note, it does
73 // depend on the current locale.
74 static base::ListValue* GetLanguageList();
76 // Returns available input methods. Caller gets the ownership. Note, it does
77 // depend on the current locale.
78 static base::ListValue* GetInputMethods();
80 // Returns available timezones. Caller gets the ownership.
81 static base::ListValue* GetTimezoneList();
83 NetworkScreenActor::Delegate* screen_;
84 CoreOobeActor* core_oobe_actor_;
86 bool is_continue_enabled_;
88 // Keeps whether screen should be shown right after initialization.
89 bool show_on_init_;
91 // Position of the network control.
92 gfx::Point network_control_pos_;
94 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_;
96 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_;
98 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler);
101 } // namespace chromeos
103 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_