Home | History | Annotate | Download | only in chromeos
      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 "base/compiler_specific.h"
      9 #include "chrome/browser/chromeos/ui_proxy_config_service.h"
     10 #include "chrome/browser/ui/webui/options/core_options_handler.h"
     11 
     12 namespace chromeos {
     13 namespace options {
     14 
     15 // CoreChromeOSOptionsHandler handles ChromeOS settings.
     16 class CoreChromeOSOptionsHandler : public ::options::CoreOptionsHandler {
     17  public:
     18   CoreChromeOSOptionsHandler();
     19   virtual ~CoreChromeOSOptionsHandler();
     20 
     21   // ::CoreOptionsHandler overrides
     22   virtual void RegisterMessages() OVERRIDE;
     23   virtual base::Value* FetchPref(const std::string& pref_name) OVERRIDE;
     24   virtual void InitializeHandler() OVERRIDE;
     25   virtual void ObservePref(const std::string& pref_name) OVERRIDE;
     26   virtual void SetPref(const std::string& pref_name,
     27                        const base::Value* value,
     28                        const std::string& metric) OVERRIDE;
     29   virtual void StopObservingPref(const std::string& path) OVERRIDE;
     30 
     31   // OptionsPageUIHandler implementation.
     32   virtual void GetLocalizedValues(
     33       base::DictionaryValue* localized_strings) OVERRIDE;
     34 
     35   // content::NotificationObserver implementation.
     36   virtual void Observe(int type,
     37                        const content::NotificationSource& source,
     38                        const content::NotificationDetails& details) OVERRIDE;
     39 
     40  private:
     41   virtual void OnPreferenceChanged(PrefService* service,
     42                                    const std::string& pref_name) OVERRIDE;
     43 
     44   // Called from Javascript to select the network to show proxy settings
     45   // for. Triggers pref notifications about the updated proxy settings.
     46   void SelectNetworkCallback(const base::ListValue* args);
     47 
     48   // Notifies registered JS callbacks on ChromeOS setting change.
     49   void NotifySettingsChanged(const std::string* setting_name);
     50   void NotifyProxyPrefsChanged();
     51 
     52   UIProxyConfigService proxy_config_service_;
     53 };
     54 
     55 }  // namespace options
     56 }  // namespace chromeos
     57 
     58 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CORE_CHROMEOS_OPTIONS_HANDLER_H_
     59