- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / chromeos / core_chromeos_options_handler.h
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.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CORE_CHROMEOS_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CORE_CHROMEOS_OPTIONS_HANDLER_H_
7
8 #include <map>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/linked_ptr.h"
12 #include "chrome/browser/chromeos/settings/cros_settings.h"
13 #include "chrome/browser/chromeos/ui_proxy_config_service.h"
14 #include "chrome/browser/ui/webui/options/core_options_handler.h"
15
16 namespace chromeos {
17 namespace options {
18
19 // CoreChromeOSOptionsHandler handles ChromeOS settings.
20 class CoreChromeOSOptionsHandler : public ::options::CoreOptionsHandler {
21  public:
22   CoreChromeOSOptionsHandler();
23   virtual ~CoreChromeOSOptionsHandler();
24
25   // ::CoreOptionsHandler overrides
26   virtual void RegisterMessages() OVERRIDE;
27   virtual base::Value* FetchPref(const std::string& pref_name) OVERRIDE;
28   virtual void InitializeHandler() OVERRIDE;
29   virtual void ObservePref(const std::string& pref_name) OVERRIDE;
30   virtual void SetPref(const std::string& pref_name,
31                        const base::Value* value,
32                        const std::string& metric) OVERRIDE;
33   virtual void StopObservingPref(const std::string& path) OVERRIDE;
34
35   // OptionsPageUIHandler implementation.
36   virtual void GetLocalizedValues(
37       base::DictionaryValue* localized_strings) OVERRIDE;
38
39  private:
40   virtual void OnPreferenceChanged(PrefService* service,
41                                    const std::string& pref_name) OVERRIDE;
42
43   // Called from Javascript to select the network to show proxy settings
44   // for. Triggers pref notifications about the updated proxy settings.
45   void SelectNetworkCallback(const base::ListValue* args);
46
47   // Notifies registered JS callbacks on ChromeOS setting change.
48   void NotifySettingsChanged(const std::string& setting_name);
49   void NotifyProxyPrefsChanged();
50
51   typedef std::map<std::string, linked_ptr<CrosSettings::ObserverSubscription> >
52       SubscriptionMap;
53   SubscriptionMap pref_subscription_map_;
54
55   UIProxyConfigService proxy_config_service_;
56 };
57
58 }  // namespace options
59 }  // namespace chromeos
60
61 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CORE_CHROMEOS_OPTIONS_HANDLER_H_