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_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/webui/options/options_ui.h"
13 #include "extensions/browser/extension_registry_observer.h"
14 #include "ui/gfx/native_widget_types.h"
30 // ChromeOS internet options page UI handler.
31 class InternetOptionsHandler
: public ::options::OptionsPageUIHandler
,
32 public extensions::ExtensionRegistryObserver
{
34 InternetOptionsHandler();
35 ~InternetOptionsHandler() override
;
38 // OptionsPageUIHandler
39 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
40 void InitializePage() override
;
42 // WebUIMessageHandler (from OptionsPageUIHandler)
43 void RegisterMessages() override
;
45 // ExtensionRegistryObserver
46 void OnExtensionLoaded(content::BrowserContext
* browser_context
,
47 const extensions::Extension
* extension
) override
;
48 void OnExtensionUnloaded(
49 content::BrowserContext
* browser_context
,
50 const extensions::Extension
* extension
,
51 extensions::UnloadedExtensionInfo::Reason reason
) override
;
52 void OnShutdown(extensions::ExtensionRegistry
* registry
) override
;
54 // Callbacks to set network state properties.
55 void ShowMorePlanInfoCallback(const base::ListValue
* args
);
56 void SimOperationCallback(const base::ListValue
* args
);
58 // Updates the list of VPN providers enabled in the primary user's profile.
59 void UpdateVPNProviders();
61 // Gets the native window for hosting dialogs, etc.
62 gfx::NativeWindow
GetNativeWindow() const;
64 // Gets the user PrefService associated with the WebUI.
65 const PrefService
* GetPrefs() const;
67 // Additional callbacks for managing networks.
68 void AddVPNConnection(const base::ListValue
* args
);
69 void AddNonVPNConnection(const base::ListValue
* args
);
70 void ConfigureNetwork(const base::ListValue
* args
);
72 // Requests that a list of VPN providers enabled in the primary user's
73 // profile be sent to JavaScript.
74 void LoadVPNProvidersCallback(const base::ListValue
* args
);
76 // Weak pointer factory so we can start connections at a later time
77 // without worrying that they will actually try to happen after the lifetime
79 base::WeakPtrFactory
<InternetOptionsHandler
> weak_factory_
;
81 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler
);
84 } // namespace options
85 } // namespace chromeos
87 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_