| 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" | 7 #include "ash/resources/grit/ash_resources.h" |
| 8 #include "ash/system/chromeos/network/network_connect.h" | 8 #include "ash/system/chromeos/network/network_connect.h" |
| 9 #include "ash/system/system_notifier.h" | 9 #include "ash/system/system_notifier.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/message_center/message_center.h" | 33 #include "ui/message_center/message_center.h" |
| 34 #include "ui/message_center/notification.h" | 34 #include "ui/message_center/notification.h" |
| 35 #include "ui/views/view.h" | 35 #include "ui/views/view.h" |
| 36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 37 | 37 |
| 38 namespace chromeos { | 38 namespace chromeos { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const char kDataPromoNotificationId[] = "chrome://settings/internet/data_promo"; |
| 43 |
| 42 const int kNotificationCountPrefDefault = -1; | 44 const int kNotificationCountPrefDefault = -1; |
| 43 | 45 |
| 44 bool GetBooleanPref(const char* pref_name) { | 46 bool GetBooleanPref(const char* pref_name) { |
| 45 Profile* profile = ProfileManager::GetPrimaryUserProfile(); | 47 Profile* profile = ProfileManager::GetPrimaryUserProfile(); |
| 46 PrefService* prefs = profile->GetPrefs(); | 48 PrefService* prefs = profile->GetPrefs(); |
| 47 return prefs->GetBoolean(pref_name); | 49 return prefs->GetBoolean(pref_name); |
| 48 } | 50 } |
| 49 | 51 |
| 50 int GetIntegerLocalPref(const char* pref_name) { | 52 int GetIntegerLocalPref(const char* pref_name) { |
| 51 PrefService* prefs = g_browser_process->local_state(); | 53 PrefService* prefs = g_browser_process->local_state(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 NET_LOG_DEBUG("Carrier Deal Found", deal_text); | 116 NET_LOG_DEBUG("Carrier Deal Found", deal_text); |
| 115 if (deal_text.empty()) | 117 if (deal_text.empty()) |
| 116 return NULL; | 118 return NULL; |
| 117 } | 119 } |
| 118 return deal; | 120 return deal; |
| 119 } | 121 } |
| 120 | 122 |
| 121 void NotificationClicked(const std::string& service_path, | 123 void NotificationClicked(const std::string& service_path, |
| 122 const std::string& info_url) { | 124 const std::string& info_url) { |
| 123 if (info_url.empty()) | 125 if (info_url.empty()) |
| 124 ash::network_connect::ShowNetworkSettings(service_path); | 126 ash::NetworkConnect::Get()->ShowNetworkSettings(service_path); |
| 125 | 127 |
| 126 chrome::ScopedTabbedBrowserDisplayer displayer( | 128 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 127 ProfileManager::GetPrimaryUserProfile(), | 129 ProfileManager::GetPrimaryUserProfile(), |
| 128 chrome::HOST_DESKTOP_TYPE_ASH); | 130 chrome::HOST_DESKTOP_TYPE_ASH); |
| 129 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); | 131 chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace | 134 } // namespace |
| 133 | 135 |
| 134 //////////////////////////////////////////////////////////////////////////////// | 136 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 int icon_id; | 208 int icon_id; |
| 207 if (default_network->network_technology() == shill::kNetworkTechnologyLte) | 209 if (default_network->network_technology() == shill::kNetworkTechnologyLte) |
| 208 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; | 210 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; |
| 209 else | 211 else |
| 210 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_3G; | 212 icon_id = IDR_AURA_UBER_TRAY_NOTIFICATION_3G; |
| 211 const gfx::Image& icon = | 213 const gfx::Image& icon = |
| 212 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); | 214 ui::ResourceBundle::GetSharedInstance().GetImageNamed(icon_id); |
| 213 | 215 |
| 214 message_center::MessageCenter::Get()->AddNotification( | 216 message_center::MessageCenter::Get()->AddNotification( |
| 215 message_center::Notification::CreateSystemNotification( | 217 message_center::Notification::CreateSystemNotification( |
| 216 ash::network_connect::kNetworkActivateNotificationId, | 218 kDataPromoNotificationId, base::string16() /* title */, message, icon, |
| 217 base::string16() /* title */, | |
| 218 message, | |
| 219 icon, | |
| 220 ash::system_notifier::kNotifierNetwork, | 219 ash::system_notifier::kNotifierNetwork, |
| 221 base::Bind(&NotificationClicked, | 220 base::Bind(&NotificationClicked, default_network->path(), info_url))); |
| 222 default_network->path(), info_url))); | |
| 223 | 221 |
| 224 check_for_promo_ = false; | 222 check_for_promo_ = false; |
| 225 SetShow3gPromoNotification(false); | 223 SetShow3gPromoNotification(false); |
| 226 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) | 224 if (carrier_deal_promo_pref != kNotificationCountPrefDefault) |
| 227 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); | 225 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); |
| 228 } | 226 } |
| 229 | 227 |
| 230 } // namespace chromeos | 228 } // namespace chromeos |
| OLD | NEW |