| 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/net/network_state_notifier.h" | 5 #include "chrome/browser/chromeos/net/network_state_notifier.h" |
| 6 | 6 |
| 7 #include "ash/common/system/system_notifier.h" | 7 #include "ash/common/system/system_notifier.h" |
| 8 #include "ash/resources/grit/ash_resources.h" |
| 8 #include "base/bind.h" | 9 #include "base/bind.h" |
| 9 #include "base/location.h" | 10 #include "base/location.h" |
| 10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/chromeos/net/shill_error.h" | 14 #include "chrome/browser/chromeos/net/shill_error.h" |
| 14 #include "chrome/browser/ui/ash/system_tray_client.h" | 15 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "chromeos/network/network_configuration_handler.h" | 17 #include "chromeos/network/network_configuration_handler.h" |
| 17 #include "chromeos/network/network_connection_handler.h" | 18 #include "chromeos/network/network_connection_handler.h" |
| 18 #include "chromeos/network/network_state.h" | 19 #include "chromeos/network/network_state.h" |
| 19 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
| 20 #include "chromeos/network/shill_property_util.h" | 21 #include "chromeos/network/shill_property_util.h" |
| 21 #include "components/device_event_log/device_event_log.h" | 22 #include "components/device_event_log/device_event_log.h" |
| 22 #include "third_party/cros_system_api/dbus/service_constants.h" | 23 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" | |
| 26 #include "ui/message_center/message_center.h" | 26 #include "ui/message_center/message_center.h" |
| 27 #include "ui/message_center/notification.h" | 27 #include "ui/message_center/notification.h" |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const int kMinTimeBetweenOutOfCreditsNotifySeconds = 10 * 60; | 33 const int kMinTimeBetweenOutOfCreditsNotifySeconds = 10 * 60; |
| 34 | 34 |
| 35 // Ignore in-progress error. | 35 // Ignore in-progress error. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 // Only display a notification if this network was activating and is now | 240 // Only display a notification if this network was activating and is now |
| 241 // activated. | 241 // activated. |
| 242 if (!cellular_activating_.count(cellular->path()) || | 242 if (!cellular_activating_.count(cellular->path()) || |
| 243 activation_state != shill::kActivationStateActivated) | 243 activation_state != shill::kActivationStateActivated) |
| 244 return; | 244 return; |
| 245 | 245 |
| 246 cellular_activating_.erase(cellular->path()); | 246 cellular_activating_.erase(cellular->path()); |
| 247 int icon_id; | 247 int icon_id; |
| 248 if (cellular->network_technology() == shill::kNetworkTechnologyLte) | 248 if (cellular->network_technology() == shill::kNetworkTechnologyLte) |
| 249 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; | 249 icon_id = IDR_AURA_UBER_TRAY_NETWORK_NOTIFICATION_LTE; |
| 250 else | 250 else |
| 251 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_3G; | 251 icon_id = IDR_AURA_UBER_TRAY_NETWORK_NOTIFICATION_3G; |
| 252 const gfx::Image& icon = | 252 const gfx::Image& icon = |
| 253 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); | 253 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); |
| 254 message_center::MessageCenter::Get()->AddNotification( | 254 message_center::MessageCenter::Get()->AddNotification( |
| 255 message_center::Notification::CreateSystemNotification( | 255 message_center::Notification::CreateSystemNotification( |
| 256 kNetworkActivateNotificationId, | 256 kNetworkActivateNotificationId, |
| 257 l10n_util::GetStringUTF16(IDS_NETWORK_CELLULAR_ACTIVATED_TITLE), | 257 l10n_util::GetStringUTF16(IDS_NETWORK_CELLULAR_ACTIVATED_TITLE), |
| 258 l10n_util::GetStringFUTF16(IDS_NETWORK_CELLULAR_ACTIVATED, | 258 l10n_util::GetStringFUTF16(IDS_NETWORK_CELLULAR_ACTIVATED, |
| 259 base::UTF8ToUTF16((cellular->name()))), | 259 base::UTF8ToUTF16((cellular->name()))), |
| 260 icon, ash::system_notifier::kNotifierNetwork, | 260 icon, ash::system_notifier::kNotifierNetwork, |
| 261 base::Bind(&NetworkStateNotifier::ShowNetworkSettings, | 261 base::Bind(&NetworkStateNotifier::ShowNetworkSettings, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 weak_ptr_factory_.GetWeakPtr(), vpn->guid())); | 440 weak_ptr_factory_.GetWeakPtr(), vpn->guid())); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void NetworkStateNotifier::ShowNetworkSettings(const std::string& network_id) { | 443 void NetworkStateNotifier::ShowNetworkSettings(const std::string& network_id) { |
| 444 if (!SystemTrayClient::Get()) | 444 if (!SystemTrayClient::Get()) |
| 445 return; | 445 return; |
| 446 SystemTrayClient::Get()->ShowNetworkSettings(network_id); | 446 SystemTrayClient::Get()->ShowNetworkSettings(network_id); |
| 447 } | 447 } |
| 448 | 448 |
| 449 } // namespace chromeos | 449 } // namespace chromeos |
| OLD | NEW |