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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 262 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
263 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); | 263 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); |
264 | 264 |
265 Notification notification( | 265 Notification notification( |
266 message_center::NOTIFICATION_TYPE_SIMPLE, | 266 message_center::NOTIFICATION_TYPE_SIMPLE, |
267 GURL(kPrivetNotificationOriginUrl), | 267 GURL(kPrivetNotificationOriginUrl), |
268 title, | 268 title, |
269 body, | 269 body, |
270 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 270 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
271 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), | 271 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), |
272 blink::WebTextDirectionDefault, | |
273 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), | 272 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), |
274 product_name, | 273 product_name, |
275 base::UTF8ToUTF16(kPrivetNotificationID), | 274 base::UTF8ToUTF16(kPrivetNotificationID), |
276 rich_notification_data, | 275 rich_notification_data, |
277 new PrivetNotificationDelegate(profile_)); | 276 new PrivetNotificationDelegate(profile_)); |
278 | 277 |
279 bool updated = g_browser_process->notification_ui_manager()->Update( | 278 bool updated = g_browser_process->notification_ui_manager()->Update( |
280 notification, profile_object); | 279 notification, profile_object); |
281 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { | 280 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { |
282 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); | 281 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 391 |
393 void PrivetNotificationDelegate::DisableNotifications() { | 392 void PrivetNotificationDelegate::DisableNotifications() { |
394 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 393 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
395 | 394 |
396 profile_obj->GetPrefs()->SetBoolean( | 395 profile_obj->GetPrefs()->SetBoolean( |
397 prefs::kLocalDiscoveryNotificationsEnabled, | 396 prefs::kLocalDiscoveryNotificationsEnabled, |
398 false); | 397 false); |
399 } | 398 } |
400 | 399 |
401 } // namespace local_discovery | 400 } // namespace local_discovery |
OLD | NEW |