OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_notifications.h" | 5 #include "chrome/browser/local_discovery/privet_notifications.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 rich_notification_data.buttons.push_back( | 251 rich_notification_data.buttons.push_back( |
252 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 252 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
253 IDS_LOCAL_DISCOVERY_NOTIFICATION_BUTTON_PRINTER))); | 253 IDS_LOCAL_DISCOVERY_NOTIFICATION_BUTTON_PRINTER))); |
254 | 254 |
255 rich_notification_data.buttons.push_back( | 255 rich_notification_data.buttons.push_back( |
256 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 256 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
257 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); | 257 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); |
258 | 258 |
259 Notification notification( | 259 Notification notification( |
260 message_center::NOTIFICATION_TYPE_SIMPLE, | 260 message_center::NOTIFICATION_TYPE_SIMPLE, title, body, |
261 GURL(kPrivetNotificationOriginUrl), | |
262 title, | |
263 body, | |
264 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 261 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
265 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), | 262 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), |
266 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), | 263 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), |
267 product_name, | 264 product_name, GURL(kPrivetNotificationOriginUrl), kPrivetNotificationID, |
268 kPrivetNotificationID, | 265 rich_notification_data, new PrivetNotificationDelegate(profile_)); |
269 rich_notification_data, | |
270 new PrivetNotificationDelegate(profile_)); | |
271 | 266 |
272 bool updated = g_browser_process->notification_ui_manager()->Update( | 267 bool updated = g_browser_process->notification_ui_manager()->Update( |
273 notification, profile_object); | 268 notification, profile_object); |
274 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { | 269 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { |
275 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); | 270 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); |
276 g_browser_process->notification_ui_manager()->Add(notification, | 271 g_browser_process->notification_ui_manager()->Add(notification, |
277 profile_object); | 272 profile_object); |
278 } | 273 } |
279 } | 274 } |
280 | 275 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 380 |
386 void PrivetNotificationDelegate::DisableNotifications() { | 381 void PrivetNotificationDelegate::DisableNotifications() { |
387 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 382 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
388 | 383 |
389 profile_obj->GetPrefs()->SetBoolean( | 384 profile_obj->GetPrefs()->SetBoolean( |
390 prefs::kLocalDiscoveryNotificationsEnabled, | 385 prefs::kLocalDiscoveryNotificationsEnabled, |
391 false); | 386 false); |
392 } | 387 } |
393 | 388 |
394 } // namespace local_discovery | 389 } // namespace local_discovery |
OLD | NEW |