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