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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 IDS_LOCAL_DISCOVERY_NOTIFICATION_BUTTON_PRINTER))); | 254 IDS_LOCAL_DISCOVERY_NOTIFICATION_BUTTON_PRINTER))); |
255 | 255 |
256 rich_notification_data.buttons.push_back( | 256 rich_notification_data.buttons.push_back( |
257 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 257 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
258 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); | 258 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); |
259 | 259 |
260 Notification notification( | 260 Notification notification( |
261 message_center::NOTIFICATION_TYPE_SIMPLE, title, body, | 261 message_center::NOTIFICATION_TYPE_SIMPLE, title, body, |
262 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 262 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
263 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), | 263 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), |
264 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), | 264 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 265 kPrivetNotificationID), |
265 product_name, GURL(kPrivetNotificationOriginUrl), kPrivetNotificationID, | 266 product_name, GURL(kPrivetNotificationOriginUrl), kPrivetNotificationID, |
266 rich_notification_data, new PrivetNotificationDelegate(profile_)); | 267 rich_notification_data, new PrivetNotificationDelegate(profile_)); |
267 | 268 |
268 bool updated = g_browser_process->notification_ui_manager()->Update( | 269 bool updated = g_browser_process->notification_ui_manager()->Update( |
269 notification, profile_object); | 270 notification, profile_object); |
270 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { | 271 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { |
271 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); | 272 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); |
272 g_browser_process->notification_ui_manager()->Add(notification, | 273 g_browser_process->notification_ui_manager()->Add(notification, |
273 profile_object); | 274 profile_object); |
274 } | 275 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 382 |
382 void PrivetNotificationDelegate::DisableNotifications() { | 383 void PrivetNotificationDelegate::DisableNotifications() { |
383 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 384 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
384 | 385 |
385 profile_obj->GetPrefs()->SetBoolean( | 386 profile_obj->GetPrefs()->SetBoolean( |
386 prefs::kLocalDiscoveryNotificationsEnabled, | 387 prefs::kLocalDiscoveryNotificationsEnabled, |
387 false); | 388 false); |
388 } | 389 } |
389 | 390 |
390 } // namespace local_discovery | 391 } // namespace local_discovery |
OLD | NEW |