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 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
13 #include "ash/system/audio/audio_observer.h" | 13 #include "ash/system/audio/audio_observer.h" |
14 #include "ash/system/bluetooth/bluetooth_observer.h" | 14 #include "ash/system/bluetooth/bluetooth_observer.h" |
15 #include "ash/system/brightness/brightness_observer.h" | 15 #include "ash/system/brightness/brightness_observer.h" |
16 #include "ash/system/chromeos/network/network_observer.h" | 16 #include "ash/system/chromeos/network/network_observer.h" |
| 17 #include "ash/system/chromeos/network/network_tray_delegate.h" |
17 #include "ash/system/date/clock_observer.h" | 18 #include "ash/system/date/clock_observer.h" |
18 #include "ash/system/drive/drive_observer.h" | 19 #include "ash/system/drive/drive_observer.h" |
19 #include "ash/system/ime/ime_observer.h" | 20 #include "ash/system/ime/ime_observer.h" |
20 #include "ash/system/logout_button/logout_button_observer.h" | 21 #include "ash/system/logout_button/logout_button_observer.h" |
21 #include "ash/system/power/power_status_observer.h" | 22 #include "ash/system/power/power_status_observer.h" |
22 #include "ash/system/tray/system_tray.h" | 23 #include "ash/system/tray/system_tray.h" |
23 #include "ash/system/tray/system_tray_delegate.h" | 24 #include "ash/system/tray/system_tray_delegate.h" |
24 #include "ash/system/tray/system_tray_notifier.h" | 25 #include "ash/system/tray/system_tray_notifier.h" |
25 #include "ash/system/tray_accessibility.h" | 26 #include "ash/system/tray_accessibility.h" |
26 #include "ash/system/tray_caps_lock.h" | 27 #include "ash/system/tray_caps_lock.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 180 |
180 void BluetoothSetDiscoveringError() { | 181 void BluetoothSetDiscoveringError() { |
181 LOG(ERROR) << "BluetoothSetDiscovering failed."; | 182 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
182 } | 183 } |
183 | 184 |
184 void BluetoothDeviceConnectError( | 185 void BluetoothDeviceConnectError( |
185 device::BluetoothDevice::ConnectErrorCode error_code) { | 186 device::BluetoothDevice::ConnectErrorCode error_code) { |
186 // TODO(sad): Do something? | 187 // TODO(sad): Do something? |
187 } | 188 } |
188 | 189 |
| 190 ash::NetworkObserver::NetworkType NetworkTypeForCellular( |
| 191 const CellularNetwork* cellular) { |
| 192 if (cellular->network_technology() == NETWORK_TECHNOLOGY_LTE || |
| 193 cellular->network_technology() == NETWORK_TECHNOLOGY_LTE_ADVANCED) |
| 194 return ash::NetworkObserver::NETWORK_CELLULAR_LTE; |
| 195 return ash::NetworkObserver::NETWORK_CELLULAR; |
| 196 } |
| 197 |
189 class SystemTrayDelegate : public ash::SystemTrayDelegate, | 198 class SystemTrayDelegate : public ash::SystemTrayDelegate, |
190 public AudioHandler::VolumeObserver, | 199 public AudioHandler::VolumeObserver, |
191 public PowerManagerClient::Observer, | 200 public PowerManagerClient::Observer, |
192 public SessionManagerClient::Observer, | 201 public SessionManagerClient::Observer, |
193 public NetworkMenuIcon::Delegate, | 202 public NetworkMenuIcon::Delegate, |
194 public NetworkMenu::Delegate, | 203 public NetworkMenu::Delegate, |
195 public NetworkLibrary::NetworkManagerObserver, | 204 public NetworkLibrary::NetworkManagerObserver, |
196 public NetworkLibrary::NetworkObserver, | 205 public NetworkLibrary::NetworkObserver, |
197 public google_apis::DriveServiceObserver, | 206 public google_apis::DriveServiceObserver, |
198 public content::NotificationObserver, | 207 public content::NotificationObserver, |
(...skipping 13 matching lines...) Expand all Loading... |
212 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( | 221 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( |
213 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 222 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
214 network_icon_vpn_(ALLOW_THIS_IN_INITIALIZER_LIST( | 223 network_icon_vpn_(ALLOW_THIS_IN_INITIALIZER_LIST( |
215 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 224 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
216 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), | 225 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), |
217 clock_type_(base::k24HourClock), | 226 clock_type_(base::k24HourClock), |
218 search_key_mapped_to_(input_method::kSearchKey), | 227 search_key_mapped_to_(input_method::kSearchKey), |
219 screen_locked_(false), | 228 screen_locked_(false), |
220 data_promo_notification_(new DataPromoNotification()), | 229 data_promo_notification_(new DataPromoNotification()), |
221 cellular_activating_(false), | 230 cellular_activating_(false), |
| 231 cellular_out_of_credits_(false), |
222 volume_control_delegate_(new VolumeController()) { | 232 volume_control_delegate_(new VolumeController()) { |
223 // Register notifications on construction so that events such as | 233 // Register notifications on construction so that events such as |
224 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 234 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
225 registrar_.Add(this, | 235 registrar_.Add(this, |
226 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 236 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
227 content::NotificationService::AllSources()); | 237 content::NotificationService::AllSources()); |
228 registrar_.Add(this, | 238 registrar_.Add(this, |
229 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 239 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
230 content::NotificationService::AllSources()); | 240 content::NotificationService::AllSources()); |
231 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { | 241 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 const NetworkDevice* wifi = crosnet->wifi_enabled() ? | 750 const NetworkDevice* wifi = crosnet->wifi_enabled() ? |
741 crosnet->FindWifiDevice() : NULL; | 751 crosnet->FindWifiDevice() : NULL; |
742 if (wifi) | 752 if (wifi) |
743 crosnet->GetIPConfigsAndBlock(wifi->device_path(), wifi_mac_address, | 753 crosnet->GetIPConfigsAndBlock(wifi->device_path(), wifi_mac_address, |
744 NetworkLibrary::FORMAT_COLON_SEPARATED_HEX); | 754 NetworkLibrary::FORMAT_COLON_SEPARATED_HEX); |
745 } | 755 } |
746 | 756 |
747 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | 757 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { |
748 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 758 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
749 Network* network = crosnet->FindNetworkByPath(network_id); | 759 Network* network = crosnet->FindNetworkByPath(network_id); |
750 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 760 if (network) |
751 ash::switches::kAshDisableNewNetworkStatusArea)) { | 761 network_menu_->ConnectToNetwork(network); // Shows settings if connected |
752 // If the new network handlers are enabled, this should always trigger | 762 else |
753 // displaying the network settings UI. | 763 ShowNetworkSettings(); |
754 if (network) | |
755 network_menu_->ShowTabbedNetworkSettings(network); | |
756 else | |
757 ShowNetworkSettings(); | |
758 } else { | |
759 if (network) | |
760 network_menu_->ConnectToNetwork(network); | |
761 } | |
762 } | 764 } |
763 | 765 |
764 virtual void RequestNetworkScan() OVERRIDE { | 766 virtual void RequestNetworkScan() OVERRIDE { |
765 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 767 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
766 crosnet->RequestNetworkScan(); | 768 crosnet->RequestNetworkScan(); |
767 } | 769 } |
768 | 770 |
769 virtual void AddBluetoothDevice() OVERRIDE { | 771 virtual void AddBluetoothDevice() OVERRIDE { |
770 // Open the Bluetooth device dialog, which automatically starts the | 772 // Open the Bluetooth device dialog, which automatically starts the |
771 // discovery process. | 773 // discovery process. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 std::string new_path = network ? network->service_path() : std::string(); | 1015 std::string new_path = network ? network->service_path() : std::string(); |
1014 if (active_network_path_ != new_path) { | 1016 if (active_network_path_ != new_path) { |
1015 if (!active_network_path_.empty()) | 1017 if (!active_network_path_.empty()) |
1016 crosnet->RemoveNetworkObserver(active_network_path_, this); | 1018 crosnet->RemoveNetworkObserver(active_network_path_, this); |
1017 if (!new_path.empty()) | 1019 if (!new_path.empty()) |
1018 crosnet->AddNetworkObserver(new_path, this); | 1020 crosnet->AddNetworkObserver(new_path, this); |
1019 active_network_path_ = new_path; | 1021 active_network_path_ = new_path; |
1020 } | 1022 } |
1021 } | 1023 } |
1022 | 1024 |
1023 void RefreshNetworkDeviceObserver(NetworkLibrary* crosnet) { | |
1024 const NetworkDevice* cellular = crosnet->FindCellularDevice(); | |
1025 std::string new_cellular_device_path = cellular ? | |
1026 cellular->device_path() : std::string(); | |
1027 if (cellular_device_path_ != new_cellular_device_path) | |
1028 cellular_device_path_ = new_cellular_device_path; | |
1029 } | |
1030 | |
1031 void AddNetworkToList(std::vector<ash::NetworkIconInfo>* list, | 1025 void AddNetworkToList(std::vector<ash::NetworkIconInfo>* list, |
1032 std::set<const Network*>* added, | 1026 std::set<const Network*>* added, |
1033 const Network* network) { | 1027 const Network* network) { |
1034 // Only add networks to the list once. | 1028 // Only add networks to the list once. |
1035 if (added->find(network) != added->end()) | 1029 if (added->find(network) != added->end()) |
1036 return; | 1030 return; |
1037 | 1031 |
1038 ash::NetworkIconInfo info = CreateNetworkIconInfo(network); | 1032 ash::NetworkIconInfo info = CreateNetworkIconInfo(network); |
1039 switch (network->type()) { | 1033 switch (network->type()) { |
1040 case TYPE_ETHERNET: | 1034 case TYPE_ETHERNET: |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 virtual void OpenButtonOptions() OVERRIDE { | 1134 virtual void OpenButtonOptions() OVERRIDE { |
1141 } | 1135 } |
1142 | 1136 |
1143 virtual bool ShouldOpenButtonOptions() const OVERRIDE { | 1137 virtual bool ShouldOpenButtonOptions() const OVERRIDE { |
1144 return false; | 1138 return false; |
1145 } | 1139 } |
1146 | 1140 |
1147 // Overridden from NetworkLibrary::NetworkManagerObserver. | 1141 // Overridden from NetworkLibrary::NetworkManagerObserver. |
1148 virtual void OnNetworkManagerChanged(NetworkLibrary* crosnet) OVERRIDE { | 1142 virtual void OnNetworkManagerChanged(NetworkLibrary* crosnet) OVERRIDE { |
1149 RefreshNetworkObserver(crosnet); | 1143 RefreshNetworkObserver(crosnet); |
1150 RefreshNetworkDeviceObserver(crosnet); | |
1151 data_promo_notification_->ShowOptionalMobileDataPromoNotification( | 1144 data_promo_notification_->ShowOptionalMobileDataPromoNotification( |
1152 crosnet, GetPrimarySystemTray(), this); | 1145 crosnet, GetPrimarySystemTray(), this); |
1153 UpdateCellularActivation(); | 1146 UpdateCellular(); |
1154 | 1147 |
1155 NotifyRefreshNetwork(); | 1148 NotifyRefreshNetwork(); |
1156 } | 1149 } |
1157 | 1150 |
1158 // Overridden from NetworkLibrary::NetworkObserver. | 1151 // Overridden from NetworkLibrary::NetworkObserver. |
1159 virtual void OnNetworkChanged(NetworkLibrary* crosnet, | 1152 virtual void OnNetworkChanged(NetworkLibrary* crosnet, |
1160 const Network* network) OVERRIDE { | 1153 const Network* network) OVERRIDE { |
1161 NotifyRefreshNetwork(); | 1154 NotifyRefreshNetwork(); |
1162 } | 1155 } |
1163 | 1156 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 virtual void OnCapsLockChange(bool enabled) OVERRIDE { | 1342 virtual void OnCapsLockChange(bool enabled) OVERRIDE { |
1350 bool search_mapped_to_caps_lock = false; | 1343 bool search_mapped_to_caps_lock = false; |
1351 if (!base::chromeos::IsRunningOnChromeOS() || | 1344 if (!base::chromeos::IsRunningOnChromeOS() || |
1352 search_key_mapped_to_ == input_method::kCapsLockKey) | 1345 search_key_mapped_to_ == input_method::kCapsLockKey) |
1353 search_mapped_to_caps_lock = true; | 1346 search_mapped_to_caps_lock = true; |
1354 GetSystemTrayNotifier()->NotifyCapsLockChanged( | 1347 GetSystemTrayNotifier()->NotifyCapsLockChanged( |
1355 enabled, search_mapped_to_caps_lock); | 1348 enabled, search_mapped_to_caps_lock); |
1356 } | 1349 } |
1357 | 1350 |
1358 // Overridden from ash::NetworkTrayDelegate | 1351 // Overridden from ash::NetworkTrayDelegate |
1359 virtual void NotificationLinkClicked(size_t index) OVERRIDE { | 1352 virtual void NotificationLinkClicked( |
| 1353 ash::NetworkObserver::MessageType message_type, |
| 1354 size_t link_index) OVERRIDE { |
| 1355 if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) { |
| 1356 const CellularNetwork* cellular = |
| 1357 CrosLibrary::Get()->GetNetworkLibrary()->cellular_network(); |
| 1358 if (cellular) |
| 1359 ConnectToNetwork(cellular->service_path()); |
| 1360 ash::Shell::GetInstance()->system_tray_notifier()-> |
| 1361 NotifyClearNetworkMessage(message_type); |
| 1362 } |
| 1363 if (message_type != ash::NetworkObserver::MESSAGE_DATA_PROMO) |
| 1364 return; |
1360 // If we have deal info URL defined that means that there're | 1365 // If we have deal info URL defined that means that there're |
1361 // 2 links in bubble. Let the user close it manually then thus giving | 1366 // 2 links in bubble. Let the user close it manually then thus giving |
1362 // ability to navigate to second link. | 1367 // ability to navigate to second link. |
1363 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. | 1368 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. |
1364 std::string deal_info_url = data_promo_notification_->deal_info_url(); | 1369 std::string deal_info_url = data_promo_notification_->deal_info_url(); |
1365 std::string deal_topup_url = data_promo_notification_->deal_topup_url(); | 1370 std::string deal_topup_url = data_promo_notification_->deal_topup_url(); |
1366 if (deal_info_url.empty()) | 1371 if (deal_info_url.empty()) |
1367 data_promo_notification_->CloseNotification(); | 1372 data_promo_notification_->CloseNotification(); |
1368 | 1373 |
1369 std::string deal_url_to_open; | 1374 std::string deal_url_to_open; |
1370 if (index == 0) { | 1375 if (link_index == 0) { |
1371 if (!deal_topup_url.empty()) { | 1376 if (!deal_topup_url.empty()) { |
1372 deal_url_to_open = deal_topup_url; | 1377 deal_url_to_open = deal_topup_url; |
1373 } else { | 1378 } else { |
1374 const Network* cellular = | 1379 const Network* cellular = |
1375 CrosLibrary::Get()->GetNetworkLibrary()->cellular_network(); | 1380 CrosLibrary::Get()->GetNetworkLibrary()->cellular_network(); |
1376 if (!cellular) | 1381 if (!cellular) |
1377 return; | 1382 return; |
1378 network_menu_->ShowTabbedNetworkSettings(cellular); | 1383 network_menu_->ShowTabbedNetworkSettings(cellular); |
1379 return; | 1384 return; |
1380 } | 1385 } |
1381 } else if (index == 1) { | 1386 } else if (link_index == 1) { |
1382 deal_url_to_open = deal_info_url; | 1387 deal_url_to_open = deal_info_url; |
1383 } | 1388 } |
1384 | 1389 |
1385 if (!deal_url_to_open.empty()) { | 1390 if (!deal_url_to_open.empty()) { |
1386 Browser* browser = GetAppropriateBrowser(); | 1391 Browser* browser = GetAppropriateBrowser(); |
1387 if (!browser) | 1392 if (!browser) |
1388 return; | 1393 return; |
1389 chrome::ShowSingletonTab(browser, GURL(deal_url_to_open)); | 1394 chrome::ShowSingletonTab(browser, GURL(deal_url_to_open)); |
1390 } | 1395 } |
1391 } | 1396 } |
1392 | 1397 |
1393 virtual void UpdateEnterpriseDomain() { | 1398 virtual void UpdateEnterpriseDomain() { |
1394 std::string enterprise_domain = | 1399 std::string enterprise_domain = |
1395 g_browser_process->browser_policy_connector()->GetEnterpriseDomain(); | 1400 g_browser_process->browser_policy_connector()->GetEnterpriseDomain(); |
1396 if (enterprise_domain_ != enterprise_domain) { | 1401 if (enterprise_domain_ != enterprise_domain) { |
1397 enterprise_domain_ = enterprise_domain; | 1402 enterprise_domain_ = enterprise_domain; |
1398 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); | 1403 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); |
1399 } | 1404 } |
1400 } | 1405 } |
1401 | 1406 |
1402 // Overridden from CloudPolicyStore::Observer | 1407 // Overridden from CloudPolicyStore::Observer |
1403 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE { | 1408 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE { |
1404 UpdateEnterpriseDomain(); | 1409 UpdateEnterpriseDomain(); |
1405 } | 1410 } |
1406 | 1411 |
1407 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE { | 1412 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE { |
1408 UpdateEnterpriseDomain(); | 1413 UpdateEnterpriseDomain(); |
1409 } | 1414 } |
1410 | 1415 |
1411 void UpdateCellularActivation() { | 1416 void UpdateCellular() { |
1412 const CellularNetworkVector& cellular_networks = | 1417 const CellularNetworkVector& cellular_networks = |
1413 CrosLibrary::Get()->GetNetworkLibrary()->cellular_networks(); | 1418 CrosLibrary::Get()->GetNetworkLibrary()->cellular_networks(); |
1414 if (cellular_networks.empty()) | 1419 if (cellular_networks.empty()) |
1415 return; | 1420 return; |
1416 // We only care about the first cellular network (in practice there will | 1421 // We only care about the first cellular network (in practice there will |
1417 // only ever be one) | 1422 // only ever be one) |
1418 const CellularNetwork* cellular = cellular_networks[0]; | 1423 const CellularNetwork* cellular = cellular_networks[0]; |
1419 if (cellular->activation_state() == ACTIVATION_STATE_ACTIVATING) { | 1424 if (cellular->activation_state() == ACTIVATION_STATE_ACTIVATING) { |
1420 cellular_activating_ = true; | 1425 cellular_activating_ = true; |
1421 } else if (cellular->activated() && cellular_activating_) { | 1426 } else if (cellular->activated() && cellular_activating_) { |
1422 cellular_activating_ = false; | 1427 cellular_activating_ = false; |
1423 | 1428 ash::NetworkObserver::NetworkType type = NetworkTypeForCellular(cellular); |
1424 // Detect which icon to show, 3G or LTE. | |
1425 ash::NetworkObserver::NetworkType type = | |
1426 (cellular->network_technology() == NETWORK_TECHNOLOGY_LTE || | |
1427 cellular->network_technology() == NETWORK_TECHNOLOGY_LTE_ADVANCED) | |
1428 ? ash::NetworkObserver::NETWORK_CELLULAR_LTE | |
1429 : ash::NetworkObserver::NETWORK_CELLULAR; | |
1430 | |
1431 // Show the notification. | |
1432 ash::Shell::GetInstance()->system_tray_notifier()-> | 1429 ash::Shell::GetInstance()->system_tray_notifier()-> |
1433 NotifySetNetworkMessage( | 1430 NotifySetNetworkMessage( |
1434 NULL, | 1431 NULL, |
1435 ash::NetworkObserver::MESSAGE_DATA_PROMO, | 1432 ash::NetworkObserver::MESSAGE_DATA_PROMO, |
1436 type, | 1433 type, |
1437 l10n_util::GetStringUTF16( | 1434 l10n_util::GetStringUTF16( |
1438 IDS_NETWORK_CELLULAR_ACTIVATED_TITLE), | 1435 IDS_NETWORK_CELLULAR_ACTIVATED_TITLE), |
1439 l10n_util::GetStringFUTF16( | 1436 l10n_util::GetStringFUTF16( |
1440 IDS_NETWORK_CELLULAR_ACTIVATED, | 1437 IDS_NETWORK_CELLULAR_ACTIVATED, |
1441 UTF8ToUTF16((cellular->name()))), | 1438 UTF8ToUTF16((cellular->name()))), |
1442 std::vector<string16>()); | 1439 std::vector<string16>()); |
1443 } | 1440 } |
| 1441 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1442 ash::switches::kAshDisableNewNetworkStatusArea)) { |
| 1443 return; |
| 1444 } |
| 1445 // Trigger "Out of credits" notification (for NetworkLibrary impl) |
| 1446 if (cellular->out_of_credits() && !cellular_out_of_credits_) { |
| 1447 cellular_out_of_credits_ = true; |
| 1448 ash::NetworkObserver::NetworkType type = NetworkTypeForCellular(cellular); |
| 1449 std::vector<string16> links; |
| 1450 links.push_back( |
| 1451 l10n_util::GetStringFUTF16(IDS_NETWORK_OUT_OF_CREDITS_LINK, |
| 1452 UTF8ToUTF16(cellular->name()))); |
| 1453 ash::Shell::GetInstance()->system_tray_notifier()-> |
| 1454 NotifySetNetworkMessage( |
| 1455 this, ash::NetworkObserver::ERROR_OUT_OF_CREDITS, type, |
| 1456 l10n_util::GetStringUTF16(IDS_NETWORK_OUT_OF_CREDITS_TITLE), |
| 1457 l10n_util::GetStringUTF16(IDS_NETWORK_OUT_OF_CREDITS_BODY), |
| 1458 links); |
| 1459 } else if (!cellular->out_of_credits() && cellular_out_of_credits_) { |
| 1460 cellular_out_of_credits_ = false; |
| 1461 } |
1444 } | 1462 } |
1445 | 1463 |
1446 scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_; | 1464 scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_; |
1447 scoped_ptr<NetworkMenuIcon> network_icon_; | 1465 scoped_ptr<NetworkMenuIcon> network_icon_; |
1448 scoped_ptr<NetworkMenuIcon> network_icon_dark_; | 1466 scoped_ptr<NetworkMenuIcon> network_icon_dark_; |
1449 scoped_ptr<NetworkMenuIcon> network_icon_vpn_; | 1467 scoped_ptr<NetworkMenuIcon> network_icon_vpn_; |
1450 scoped_ptr<NetworkMenu> network_menu_; | 1468 scoped_ptr<NetworkMenu> network_menu_; |
1451 content::NotificationRegistrar registrar_; | 1469 content::NotificationRegistrar registrar_; |
1452 PrefChangeRegistrar local_state_registrar_; | 1470 PrefChangeRegistrar local_state_registrar_; |
1453 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; | 1471 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; |
1454 std::string cellular_device_path_; | |
1455 std::string active_network_path_; | 1472 std::string active_network_path_; |
1456 PowerSupplyStatus power_supply_status_; | 1473 PowerSupplyStatus power_supply_status_; |
1457 base::HourClockType clock_type_; | 1474 base::HourClockType clock_type_; |
1458 int search_key_mapped_to_; | 1475 int search_key_mapped_to_; |
1459 bool screen_locked_; | 1476 bool screen_locked_; |
1460 base::Time session_start_time_; | 1477 base::Time session_start_time_; |
1461 base::TimeDelta session_length_limit_; | 1478 base::TimeDelta session_length_limit_; |
1462 std::string enterprise_domain_; | 1479 std::string enterprise_domain_; |
1463 | 1480 |
1464 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 1481 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
1465 | 1482 |
1466 scoped_ptr<DataPromoNotification> data_promo_notification_; | 1483 scoped_ptr<DataPromoNotification> data_promo_notification_; |
1467 bool cellular_activating_; | 1484 bool cellular_activating_; |
| 1485 bool cellular_out_of_credits_; |
1468 | 1486 |
1469 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; | 1487 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; |
1470 | 1488 |
1471 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1489 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1472 }; | 1490 }; |
1473 | 1491 |
1474 } // namespace | 1492 } // namespace |
1475 | 1493 |
1476 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1494 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1477 return new chromeos::SystemTrayDelegate(); | 1495 return new chromeos::SystemTrayDelegate(); |
1478 } | 1496 } |
1479 | 1497 |
1480 } // namespace chromeos | 1498 } // namespace chromeos |
OLD | NEW |