| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/cros/network_library.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class InternetOptionsHandler | 21 class InternetOptionsHandler |
| 22 : public chromeos::CrosOptionsPageUIHandler, | 22 : public chromeos::CrosOptionsPageUIHandler, |
| 23 public chromeos::NetworkLibrary::NetworkManagerObserver, | 23 public chromeos::NetworkLibrary::NetworkManagerObserver, |
| 24 public chromeos::NetworkLibrary::NetworkObserver, | 24 public chromeos::NetworkLibrary::NetworkObserver, |
| 25 public chromeos::NetworkLibrary::CellularDataPlanObserver { | 25 public chromeos::NetworkLibrary::CellularDataPlanObserver { |
| 26 public: | 26 public: |
| 27 InternetOptionsHandler(); | 27 InternetOptionsHandler(); |
| 28 virtual ~InternetOptionsHandler(); | 28 virtual ~InternetOptionsHandler(); |
| 29 | 29 |
| 30 // OptionsPageUIHandler implementation. | 30 // OptionsPageUIHandler implementation. |
| 31 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 31 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 32 virtual void Initialize(); | 32 virtual void Initialize(); |
| 33 | 33 |
| 34 // WebUIMessageHandler implementation. | 34 // WebUIMessageHandler implementation. |
| 35 virtual void RegisterMessages(); | 35 virtual void RegisterMessages(); |
| 36 | 36 |
| 37 // NetworkLibrary::NetworkManagerObserver implementation. | 37 // NetworkLibrary::NetworkManagerObserver implementation. |
| 38 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* network_lib); | 38 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* network_lib); |
| 39 // NetworkLibrary::NetworkObserver implementation. | 39 // NetworkLibrary::NetworkObserver implementation. |
| 40 virtual void OnNetworkChanged(chromeos::NetworkLibrary* network_lib, | 40 virtual void OnNetworkChanged(chromeos::NetworkLibrary* network_lib, |
| 41 const chromeos::Network* network); | 41 const chromeos::Network* network); |
| 42 // NetworkLibrary::CellularDataPlanObserver implementation. | 42 // NetworkLibrary::CellularDataPlanObserver implementation. |
| 43 virtual void OnCellularDataPlanChanged(chromeos::NetworkLibrary* network_lib); | 43 virtual void OnCellularDataPlanChanged(chromeos::NetworkLibrary* network_lib); |
| 44 | 44 |
| 45 // NotificationObserver implementation. | 45 // NotificationObserver implementation. |
| 46 virtual void Observe(int type, | 46 virtual void Observe(int type, |
| 47 const NotificationSource& source, | 47 const NotificationSource& source, |
| 48 const NotificationDetails& details) OVERRIDE; | 48 const NotificationDetails& details) OVERRIDE; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // Opens a modal popup dialog. | 51 // Opens a modal popup dialog. |
| 52 void CreateModalPopup(views::WidgetDelegate* view); | 52 void CreateModalPopup(views::WidgetDelegate* view); |
| 53 gfx::NativeWindow GetNativeWindow() const; | 53 gfx::NativeWindow GetNativeWindow() const; |
| 54 | 54 |
| 55 // Passes data needed to show details overlay for network. | 55 // Passes data needed to show details overlay for network. |
| 56 // |args| will be [ network_type, service_path, command ] | 56 // |args| will be [ network_type, service_path, command ] |
| 57 // And command is one of 'options', 'connect', disconnect', 'activate' or | 57 // And command is one of 'options', 'connect', disconnect', 'activate' or |
| 58 // 'forget' | 58 // 'forget' |
| 59 // Handle{Wifi,Cellular}ButtonClick handles button click on a wireless | 59 // Handle{Wifi,Cellular}ButtonClick handles button click on a wireless |
| 60 // network item and a cellular network item respectively. | 60 // network item and a cellular network item respectively. |
| 61 void ButtonClickCallback(const ListValue* args); | 61 void ButtonClickCallback(const base::ListValue* args); |
| 62 void HandleWifiButtonClick(const std::string& service_path, | 62 void HandleWifiButtonClick(const std::string& service_path, |
| 63 const std::string& command); | 63 const std::string& command); |
| 64 void HandleCellularButtonClick(const std::string& service_path, | 64 void HandleCellularButtonClick(const std::string& service_path, |
| 65 const std::string& command); | 65 const std::string& command); |
| 66 void HandleVPNButtonClick(const std::string& service_path, | 66 void HandleVPNButtonClick(const std::string& service_path, |
| 67 const std::string& command); | 67 const std::string& command); |
| 68 | 68 |
| 69 // Initiates cellular plan data refresh. The results from libcros will be | 69 // Initiates cellular plan data refresh. The results from libcros will be |
| 70 // passed through CellularDataPlanChanged() callback method. | 70 // passed through CellularDataPlanChanged() callback method. |
| 71 // |args| will be [ service_path ] | 71 // |args| will be [ service_path ] |
| 72 void RefreshCellularPlanCallback(const ListValue* args); | 72 void RefreshCellularPlanCallback(const base::ListValue* args); |
| 73 void SetActivationButtonVisibility( | 73 void SetActivationButtonVisibility( |
| 74 const chromeos::CellularNetwork* cellular, | 74 const chromeos::CellularNetwork* cellular, |
| 75 DictionaryValue* dictionary); | 75 base::DictionaryValue* dictionary); |
| 76 | 76 |
| 77 void SetAutoConnectCallback(const ListValue* args); | 77 void SetAutoConnectCallback(const base::ListValue* args); |
| 78 void SetSharedCallback(const ListValue* args); | 78 void SetSharedCallback(const base::ListValue* args); |
| 79 void SetIPConfigCallback(const ListValue* args); | 79 void SetIPConfigCallback(const base::ListValue* args); |
| 80 void EnableWifiCallback(const ListValue* args); | 80 void EnableWifiCallback(const base::ListValue* args); |
| 81 void DisableWifiCallback(const ListValue* args); | 81 void DisableWifiCallback(const base::ListValue* args); |
| 82 void EnableCellularCallback(const ListValue* args); | 82 void EnableCellularCallback(const base::ListValue* args); |
| 83 void DisableCellularCallback(const ListValue* args); | 83 void DisableCellularCallback(const base::ListValue* args); |
| 84 void BuyDataPlanCallback(const ListValue* args); | 84 void BuyDataPlanCallback(const base::ListValue* args); |
| 85 void SetApnCallback(const ListValue* args); | 85 void SetApnCallback(const base::ListValue* args); |
| 86 void SetSimCardLockCallback(const ListValue* args); | 86 void SetSimCardLockCallback(const base::ListValue* args); |
| 87 void ChangePinCallback(const ListValue* args); | 87 void ChangePinCallback(const base::ListValue* args); |
| 88 void ShareNetworkCallback(const ListValue* args); | 88 void ShareNetworkCallback(const base::ListValue* args); |
| 89 | 89 |
| 90 // Populates the ui with the details of the given device path. This forces | 90 // Populates the ui with the details of the given device path. This forces |
| 91 // an overlay to be displayed in the UI. | 91 // an overlay to be displayed in the UI. |
| 92 void PopulateDictionaryDetails(const chromeos::Network* network); | 92 void PopulateDictionaryDetails(const chromeos::Network* network); |
| 93 void PopulateWifiDetails(const chromeos::WifiNetwork* wifi, | 93 void PopulateWifiDetails(const chromeos::WifiNetwork* wifi, |
| 94 DictionaryValue* dictionary); | 94 base::DictionaryValue* dictionary); |
| 95 void PopulateCellularDetails(const chromeos::CellularNetwork* cellular, | 95 void PopulateCellularDetails(const chromeos::CellularNetwork* cellular, |
| 96 DictionaryValue* dictionary); | 96 base::DictionaryValue* dictionary); |
| 97 void PopulateVPNDetails(const chromeos::VirtualNetwork* vpn, | 97 void PopulateVPNDetails(const chromeos::VirtualNetwork* vpn, |
| 98 DictionaryValue* dictionary); | 98 base::DictionaryValue* dictionary); |
| 99 | 99 |
| 100 // Converts CellularDataPlan structure into dictionary for JS. Formats plan | 100 // Converts CellularDataPlan structure into dictionary for JS. Formats plan |
| 101 // settings into human readable texts. | 101 // settings into human readable texts. |
| 102 DictionaryValue* CellularDataPlanToDictionary( | 102 base::DictionaryValue* CellularDataPlanToDictionary( |
| 103 const chromeos::CellularDataPlan* plan); | 103 const chromeos::CellularDataPlan* plan); |
| 104 // Creates the map of a network. | 104 // Creates the map of a network. |
| 105 ListValue* GetNetwork(const std::string& service_path, | 105 base::ListValue* GetNetwork(const std::string& service_path, |
| 106 const SkBitmap& icon, | 106 const SkBitmap& icon, |
| 107 const std::string& name, | 107 const std::string& name, |
| 108 bool connecting, | 108 bool connecting, |
| 109 bool connected, | 109 bool connected, |
| 110 bool connectable, | 110 bool connectable, |
| 111 chromeos::ConnectionType connection_type, | 111 chromeos::ConnectionType connection_type, |
| 112 bool remembered, | 112 bool remembered, |
| 113 bool shared, | 113 bool shared, |
| 114 chromeos::ActivationState activation_state, | 114 chromeos::ActivationState activation_state, |
| 115 bool restricted_ip); | 115 bool restricted_ip); |
| 116 | 116 |
| 117 // Creates the map of wired networks. | 117 // Creates the map of wired networks. |
| 118 ListValue* GetWiredList(); | 118 base::ListValue* GetWiredList(); |
| 119 // Creates the map of wireless networks. | 119 // Creates the map of wireless networks. |
| 120 ListValue* GetWirelessList(); | 120 base::ListValue* GetWirelessList(); |
| 121 // Creates the map of virtual networks. | 121 // Creates the map of virtual networks. |
| 122 ListValue* GetVPNList(); | 122 base::ListValue* GetVPNList(); |
| 123 // Creates the map of remembered networks. | 123 // Creates the map of remembered networks. |
| 124 ListValue* GetRememberedList(); | 124 base::ListValue* GetRememberedList(); |
| 125 // Fills network information into JS dictionary for displaying network lists. | 125 // Fills network information into JS dictionary for displaying network lists. |
| 126 void FillNetworkInfo(DictionaryValue* dictionary); | 126 void FillNetworkInfo(base::DictionaryValue* dictionary); |
| 127 // Refreshes the display of network information. | 127 // Refreshes the display of network information. |
| 128 void RefreshNetworkData(); | 128 void RefreshNetworkData(); |
| 129 // Adds observers for wireless networks, if any, so that we can dynamically | 129 // Adds observers for wireless networks, if any, so that we can dynamically |
| 130 // display the correct icon for that network's signal strength and, in the | 130 // display the correct icon for that network's signal strength and, in the |
| 131 // case of cellular networks, network technology and roaming status. | 131 // case of cellular networks, network technology and roaming status. |
| 132 void MonitorNetworks(); | 132 void MonitorNetworks(); |
| 133 | 133 |
| 134 // Convenience pointer to netwrok library (will not change). | 134 // Convenience pointer to netwrok library (will not change). |
| 135 chromeos::NetworkLibrary* cros_; | 135 chromeos::NetworkLibrary* cros_; |
| 136 | 136 |
| 137 NotificationRegistrar registrar_; | 137 NotificationRegistrar registrar_; |
| 138 | 138 |
| 139 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler); | 139 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler); |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 142 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
| OLD | NEW |