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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 259 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
260 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); | 260 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_DISABLE_BUTTON_LABEL))); |
261 | 261 |
262 Notification notification( | 262 Notification notification( |
263 message_center::NOTIFICATION_TYPE_SIMPLE, | 263 message_center::NOTIFICATION_TYPE_SIMPLE, |
264 GURL(kPrivetNotificationOriginUrl), | 264 GURL(kPrivetNotificationOriginUrl), |
265 title, | 265 title, |
266 body, | 266 body, |
267 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 267 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
268 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), | 268 IDR_LOCAL_DISCOVERY_CLOUDPRINT_ICON), |
269 WebKit::WebTextDirectionDefault, | 269 blink::WebTextDirectionDefault, |
270 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), | 270 message_center::NotifierId(GURL(kPrivetNotificationOriginUrl)), |
271 product_name, | 271 product_name, |
272 UTF8ToUTF16(kPrivetNotificationID), | 272 UTF8ToUTF16(kPrivetNotificationID), |
273 rich_notification_data, | 273 rich_notification_data, |
274 new PrivetNotificationDelegate(profile_)); | 274 new PrivetNotificationDelegate(profile_)); |
275 | 275 |
276 bool updated = g_browser_process->notification_ui_manager()->Update( | 276 bool updated = g_browser_process->notification_ui_manager()->Update( |
277 notification, profile_object); | 277 notification, profile_object); |
278 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { | 278 if (!updated && added && !LocalDiscoveryUIHandler::GetHasVisible()) { |
279 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); | 279 ReportPrivetUmaEvent(PRIVET_NOTIFICATION_SHOWN); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 void PrivetNotificationDelegate::DisableNotifications() { | 385 void PrivetNotificationDelegate::DisableNotifications() { |
386 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 386 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
387 | 387 |
388 profile_obj->GetPrefs()->SetBoolean( | 388 profile_obj->GetPrefs()->SetBoolean( |
389 prefs::kLocalDiscoveryNotificationsEnabled, | 389 prefs::kLocalDiscoveryNotificationsEnabled, |
390 false); | 390 false); |
391 } | 391 } |
392 | 392 |
393 } // namespace local_discovery | 393 } // namespace local_discovery |
OLD | NEW |