| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" |
| 11 #include "chrome/browser/chromeos/status/network_menu.h" | 11 #include "chrome/browser/chromeos/status/network_menu.h" |
| 12 #include "chrome/browser/chromeos/status/network_menu_icon.h" | 12 #include "chrome/browser/chromeos/status/network_menu_icon.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class WebUI; | 16 class WebUI; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 | 20 |
| 21 class NetworkMenuWebUI; | 21 class NetworkMenuWebUI; |
| 22 | 22 |
| 23 // Class which implements network dropdown menu using WebUI. | 23 // Class which implements network dropdown menu using WebUI. |
| 24 class NetworkDropdown : public NetworkMenu::Delegate, | 24 class NetworkDropdown : public NetworkMenu::Delegate, |
| 25 public NetworkMenuIcon::Delegate, | 25 public NetworkMenuIcon::Delegate, |
| 26 NetworkLibrary::NetworkManagerObserver { | 26 public ConnectivityStateHelperObserver { |
| 27 public: | 27 public: |
| 28 NetworkDropdown(content::WebUI* web_ui, bool oobe); | 28 NetworkDropdown(content::WebUI* web_ui, bool oobe); |
| 29 virtual ~NetworkDropdown(); | 29 virtual ~NetworkDropdown(); |
| 30 | 30 |
| 31 // Sets last active network type. Used to show correct disconnected icon. | 31 // Sets last active network type. Used to show correct disconnected icon. |
| 32 void SetLastNetworkType(ConnectionType last_network_type); | 32 void SetLastNetworkType(ConnectionType last_network_type); |
| 33 | 33 |
| 34 // This method should be called, when item with the given id is chosen. | 34 // This method should be called, when item with the given id is chosen. |
| 35 void OnItemChosen(int id); | 35 void OnItemChosen(int id); |
| 36 | 36 |
| 37 // NetworkMenu::Delegate implementation: | 37 // NetworkMenu::Delegate implementation: |
| 38 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | 38 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
| 39 virtual void OpenButtonOptions() OVERRIDE; | 39 virtual void OpenButtonOptions() OVERRIDE; |
| 40 virtual bool ShouldOpenButtonOptions() const OVERRIDE; | 40 virtual bool ShouldOpenButtonOptions() const OVERRIDE; |
| 41 | 41 |
| 42 // NetworkMenuIcon::Delegate implementation: | 42 // NetworkMenuIcon::Delegate implementation: |
| 43 virtual void NetworkMenuIconChanged() OVERRIDE; | 43 virtual void NetworkMenuIconChanged() OVERRIDE; |
| 44 | 44 |
| 45 // NetworkLibrary::NetworkManagerObserver implementation: | 45 // ConnectivityStateHelperObserver implementation: |
| 46 virtual void OnNetworkManagerChanged(NetworkLibrary* cros) OVERRIDE; | 46 virtual void NetworkManagerChanged() OVERRIDE; |
| 47 | 47 |
| 48 // Refreshes control state. Usually there's no need to do it manually | 48 // Refreshes control state. Usually there's no need to do it manually |
| 49 // as control refreshes itself on network state change. | 49 // as control refreshes itself on network state change. |
| 50 // Should be called on language change. | 50 // Should be called on language change. |
| 51 void Refresh(); | 51 void Refresh(); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 void SetNetworkIconAndText(); | 54 void SetNetworkIconAndText(); |
| 55 | 55 |
| 56 // Forces network scan and refreshes control state. Should be called | 56 // Forces network scan and refreshes control state. Should be called |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 // Timer used to periodically force network scan. | 70 // Timer used to periodically force network scan. |
| 71 base::RepeatingTimer<NetworkDropdown> network_scan_timer_; | 71 base::RepeatingTimer<NetworkDropdown> network_scan_timer_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(NetworkDropdown); | 73 DISALLOW_COPY_AND_ASSIGN(NetworkDropdown); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace chromeos | 76 } // namespace chromeos |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ | 78 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ |
| OLD | NEW |