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_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "chrome/browser/chromeos/cros/network_library.h" | 13 #include "chrome/browser/chromeos/cros/network_library.h" |
14 #include "chrome/browser/chromeos/login/message_bubble.h" | 14 #include "chrome/browser/chromeos/login/message_bubble.h" |
15 #include "chrome/browser/chromeos/mobile_config.h" | 15 #include "chrome/browser/chromeos/mobile_config.h" |
16 #include "chrome/browser/chromeos/status/network_menu.h" | 16 #include "chrome/browser/chromeos/status/network_menu.h" |
17 #include "chrome/browser/chromeos/status/network_menu_icon.h" | 17 #include "chrome/browser/chromeos/status/network_menu_icon.h" |
18 #include "chrome/browser/chromeos/status/status_area_button.h" | 18 #include "chrome/browser/chromeos/status/status_area_button.h" |
19 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | |
20 | 19 |
21 class PrefService; | 20 class PrefService; |
22 | 21 |
23 namespace chromeos { | 22 namespace chromeos { |
24 | 23 |
25 // The network menu button in the status area. | 24 // The network menu button in the status area. |
26 // This class will handle getting the wifi networks and populating the menu. | 25 // This class will handle getting the wifi networks and populating the menu. |
27 // It will also handle the status icon changing and connecting to another | 26 // It will also handle the status icon changing and connecting to another |
28 // wifi/cellular network. | 27 // wifi/cellular network. |
29 // | 28 // |
(...skipping 19 matching lines...) Expand all Loading... |
49 class NetworkMenuButton : public StatusAreaButton, | 48 class NetworkMenuButton : public StatusAreaButton, |
50 public views::ViewMenuDelegate, | 49 public views::ViewMenuDelegate, |
51 public NetworkMenu::Delegate, | 50 public NetworkMenu::Delegate, |
52 public NetworkMenuIcon::Delegate, | 51 public NetworkMenuIcon::Delegate, |
53 public NetworkLibrary::NetworkDeviceObserver, | 52 public NetworkLibrary::NetworkDeviceObserver, |
54 public NetworkLibrary::NetworkManagerObserver, | 53 public NetworkLibrary::NetworkManagerObserver, |
55 public NetworkLibrary::NetworkObserver, | 54 public NetworkLibrary::NetworkObserver, |
56 public NetworkLibrary::CellularDataPlanObserver, | 55 public NetworkLibrary::CellularDataPlanObserver, |
57 public MessageBubbleDelegate { | 56 public MessageBubbleDelegate { |
58 public: | 57 public: |
59 explicit NetworkMenuButton(StatusAreaButton::Delegate* delegate, | 58 explicit NetworkMenuButton(StatusAreaButton::Delegate* delegate); |
60 StatusAreaViewChromeos::ScreenMode screen_mode); | |
61 virtual ~NetworkMenuButton(); | 59 virtual ~NetworkMenuButton(); |
62 | 60 |
63 static void RegisterPrefs(PrefService* local_state); | 61 static void RegisterPrefs(PrefService* local_state); |
64 | 62 |
65 // NetworkLibrary::NetworkDeviceObserver implementation. | 63 // NetworkLibrary::NetworkDeviceObserver implementation. |
66 virtual void OnNetworkDeviceChanged(NetworkLibrary* cros, | 64 virtual void OnNetworkDeviceChanged(NetworkLibrary* cros, |
67 const NetworkDevice* device) OVERRIDE; | 65 const NetworkDevice* device) OVERRIDE; |
68 | 66 |
69 // NetworkLibrary::NetworkManagerObserver implementation. | 67 // NetworkLibrary::NetworkManagerObserver implementation. |
70 virtual void OnNetworkManagerChanged(NetworkLibrary* cros) OVERRIDE; | 68 virtual void OnNetworkManagerChanged(NetworkLibrary* cros) OVERRIDE; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 126 |
129 // Path of the Cellular device that we monitor property updates from. | 127 // Path of the Cellular device that we monitor property updates from. |
130 std::string cellular_device_path_; | 128 std::string cellular_device_path_; |
131 | 129 |
132 // The network icon and associated data. | 130 // The network icon and associated data. |
133 scoped_ptr<NetworkMenuIcon> network_icon_; | 131 scoped_ptr<NetworkMenuIcon> network_icon_; |
134 | 132 |
135 // Notification bubble for 3G promo. | 133 // Notification bubble for 3G promo. |
136 MessageBubble* mobile_data_bubble_; | 134 MessageBubble* mobile_data_bubble_; |
137 | 135 |
138 // Set to true if the browser is visible (i.e. not login/oobe). | |
139 bool is_browser_mode_; | |
140 | |
141 // True if check for promo needs to be done, | 136 // True if check for promo needs to be done, |
142 // otherwise just ignore it for current session. | 137 // otherwise just ignore it for current session. |
143 bool check_for_promo_; | 138 bool check_for_promo_; |
144 | 139 |
145 // Cellular device SIM was locked when we last checked | 140 // Cellular device SIM was locked when we last checked |
146 bool was_sim_locked_; | 141 bool was_sim_locked_; |
147 | 142 |
148 // If any network is currently active, this is the service path of the one | 143 // If any network is currently active, this is the service path of the one |
149 // whose status is displayed in the network menu button. | 144 // whose status is displayed in the network menu button. |
150 std::string active_network_; | 145 std::string active_network_; |
151 | 146 |
152 // Current carrier deal info URL. | 147 // Current carrier deal info URL. |
153 std::string deal_info_url_; | 148 std::string deal_info_url_; |
154 | 149 |
155 // Current carrier deal top-up URL. | 150 // Current carrier deal top-up URL. |
156 std::string deal_topup_url_; | 151 std::string deal_topup_url_; |
157 | 152 |
158 // Factory for delaying showing promo notification. | 153 // Factory for delaying showing promo notification. |
159 base::WeakPtrFactory<NetworkMenuButton> weak_ptr_factory_; | 154 base::WeakPtrFactory<NetworkMenuButton> weak_ptr_factory_; |
160 | 155 |
161 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); | 156 DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton); |
162 }; | 157 }; |
163 | 158 |
164 } // namespace chromeos | 159 } // namespace chromeos |
165 | 160 |
166 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ | 161 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_ |
OLD | NEW |