| 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/status/data_promo_notification.h" | 5 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
| 6 | 6 |
| 7 #include "ash/resources/grit/ash_resources.h" | |
| 8 #include "ash/system/chromeos/network/network_connect.h" | |
| 9 #include "ash/system/system_notifier.h" | 7 #include "ash/system/system_notifier.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chromeos/login/helper.h" | 12 #include "chrome/browser/chromeos/login/helper.h" |
| 15 #include "chrome/browser/chromeos/mobile_config.h" | 13 #include "chrome/browser/chromeos/mobile_config.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 18 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 21 #include "chrome/browser/ui/singleton_tabs.h" | 19 #include "chrome/browser/ui/singleton_tabs.h" |
| 22 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 24 #include "chromeos/login/login_state.h" | 22 #include "chromeos/login/login_state.h" |
| 25 #include "chromeos/network/device_state.h" | 23 #include "chromeos/network/device_state.h" |
| 26 #include "chromeos/network/network_connection_handler.h" | 24 #include "chromeos/network/network_connection_handler.h" |
| 27 #include "chromeos/network/network_event_log.h" | 25 #include "chromeos/network/network_event_log.h" |
| 28 #include "chromeos/network/network_state.h" | 26 #include "chromeos/network/network_state.h" |
| 29 #include "chromeos/network/network_state_handler.h" | 27 #include "chromeos/network/network_state_handler.h" |
| 28 #include "grit/ui_chromeos_resources.h" |
| 30 #include "third_party/cros_system_api/dbus/service_constants.h" | 29 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/chromeos/network/network_connect.h" |
| 33 #include "ui/chromeos/network/network_state_notifier.h" |
| 33 #include "ui/message_center/message_center.h" | 34 #include "ui/message_center/message_center.h" |
| 34 #include "ui/message_center/notification.h" | 35 #include "ui/message_center/notification.h" |
| 35 #include "ui/views/view.h" | 36 #include "ui/views/view.h" |
| 36 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 37 | 38 |
| 38 namespace chromeos { | 39 namespace chromeos { |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 const char kDataPromoNotificationId[] = "chrome://settings/internet/data_promo"; | 43 const char kDataPromoNotificationId[] = "chrome://settings/internet/data_promo"; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 NET_LOG_DEBUG("Carrier Deal Found", deal_text); | 117 NET_LOG_DEBUG("Carrier Deal Found", deal_text); |
| 117 if (deal_text.empty()) | 118 if (deal_text.empty()) |
| 118 return NULL; | 119 return NULL; |
| 119 } | 120 } |
| 120 return deal; | 121 return deal; |
| 121 } | 122 } |
| 122 | 123 |
| 123 void NotificationClicked(const std::string& service_path, | 124 void NotificationClicked(const std::string& service_path, |
| 124 const std::string& info_url) { | 125 const std::string& info_url) { |
| 125 if (info_url.empty()) | 126 if (info_url.empty()) |
| 126 ash::NetworkConnect::Get()->ShowNetworkSettings(service_path); | 127 ui::NetworkConnect::Get()->ShowNetworkSettings(service_path); |
| 127 | 128 |
| 128 chrome::ScopedTabbedBrowserDisplayer displayer( | 129 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 129 ProfileManager::GetPrimaryUserProfile(), | 130 ProfileManager::GetPrimaryUserProfile(), |
| 130 chrome::HOST_DESKTOP_TYPE_ASH); | 131 chrome::HOST_DESKTOP_TYPE_ASH); |
| 131 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); | 132 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace | 135 } // namespace |
| 135 | 136 |
| 136 //////////////////////////////////////////////////////////////////////////////// | 137 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (default_network->network_technology() == shill::kNetworkTechnologyLte) | 210 if (default_network->network_technology() == shill::kNetworkTechnologyLte) |
| 210 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; | 211 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; |
| 211 else | 212 else |
| 212 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_3G; | 213 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_3G; |
| 213 const gfx::Image& icon = | 214 const gfx::Image& icon = |
| 214 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); | 215 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); |
| 215 | 216 |
| 216 message_center::MessageCenter::Get()->AddNotification( | 217 message_center::MessageCenter::Get()->AddNotification( |
| 217 message_center::Notification::CreateSystemNotification( | 218 message_center::Notification::CreateSystemNotification( |
| 218 kDataPromoNotificationId, base::string16() /* title */, message, icon, | 219 kDataPromoNotificationId, base::string16() /* title */, message, icon, |
| 219 ash::system_notifier::kNotifierNetwork, | 220 ui::NetworkStateNotifier::kNotifierNetwork, |
| 220 base::Bind(&NotificationClicked, default_network->path(), info_url))); | 221 base::Bind(&NotificationClicked, default_network->path(), info_url))); |
| 221 | 222 |
| 222 check_for_promo_ = false; | 223 check_for_promo_ = false; |
| 223 SetShow3gPromoNotification(false); | 224 SetShow3gPromoNotification(false); |
| 224 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) | 225 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) |
| 225 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); | 226 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); |
| 226 } | 227 } |
| 227 | 228 |
| 228 } // namespace chromeos | 229 } // namespace chromeos |
| OLD | NEW |