Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chrome/browser/notifications/notification.cc

Issue 561813002: Move the logic for creating data: URLs out of DesktopNotificationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/notifications/notification.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/notifications/notification.h" 5 #include "chrome/browser/notifications/notification.h"
6 6
7 #include "base/strings/string_util.h"
8 #include "chrome/browser/notifications/desktop_notification_service.h"
9 #include "ui/base/webui/web_ui_util.h"
10
11 Notification::Notification(const GURL& origin_url, 7 Notification::Notification(const GURL& origin_url,
12 const GURL& icon_url, 8 const GURL& icon_url,
13 const base::string16& title, 9 const base::string16& title,
14 const base::string16& body, 10 const base::string16& body,
15 blink::WebTextDirection dir, 11 blink::WebTextDirection dir,
16 const base::string16& display_source, 12 const base::string16& display_source,
17 const base::string16& replace_id, 13 const base::string16& replace_id,
18 NotificationDelegate* delegate) 14 NotificationDelegate* delegate)
19 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE, 15 : message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE,
20 delegate->id(), 16 delegate->id(),
21 title, 17 title,
22 body, 18 body,
23 gfx::Image(), 19 gfx::Image(),
24 display_source, 20 display_source,
25 message_center::NotifierId(origin_url), 21 message_center::NotifierId(origin_url),
26 message_center::RichNotificationData(), 22 message_center::RichNotificationData(),
27 delegate), 23 delegate),
28 origin_url_(origin_url), 24 origin_url_(origin_url),
29 icon_url_(icon_url), 25 icon_url_(icon_url),
30 replace_id_(replace_id), 26 replace_id_(replace_id),
31 delegate_(delegate) { 27 delegate_(delegate) {}
32 // "Upconvert" the string parameters to a data: URL.
33 content_url_ = GURL(DesktopNotificationService::CreateDataUrl(
34 icon_url, title, body, dir));
35 }
36 28
37 Notification::Notification( 29 Notification::Notification(
38 message_center::NotificationType type, 30 message_center::NotificationType type,
39 const GURL& origin_url, 31 const GURL& origin_url,
40 const base::string16& title, 32 const base::string16& title,
41 const base::string16& body, 33 const base::string16& body,
42 const gfx::Image& icon, 34 const gfx::Image& icon,
43 blink::WebTextDirection dir, 35 blink::WebTextDirection dir,
44 const message_center::NotifierId& notifier_id, 36 const message_center::NotifierId& notifier_id,
45 const base::string16& display_source, 37 const base::string16& display_source,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 message_center::RichNotificationData(), 72 message_center::RichNotificationData(),
81 delegate), 73 delegate),
82 origin_url_(origin_url), 74 origin_url_(origin_url),
83 replace_id_(replace_id), 75 replace_id_(replace_id),
84 delegate_(delegate) {} 76 delegate_(delegate) {}
85 77
86 Notification::Notification(const Notification& notification) 78 Notification::Notification(const Notification& notification)
87 : message_center::Notification(notification), 79 : message_center::Notification(notification),
88 origin_url_(notification.origin_url()), 80 origin_url_(notification.origin_url()),
89 icon_url_(notification.icon_url()), 81 icon_url_(notification.icon_url()),
90 content_url_(notification.content_url()),
91 button_one_icon_url_(notification.button_one_icon_url()), 82 button_one_icon_url_(notification.button_one_icon_url()),
92 button_two_icon_url_(notification.button_two_icon_url()), 83 button_two_icon_url_(notification.button_two_icon_url()),
93 image_url_(notification.image_url()), 84 image_url_(notification.image_url()),
94 replace_id_(notification.replace_id()), 85 replace_id_(notification.replace_id()),
95 delegate_(notification.delegate()) {} 86 delegate_(notification.delegate()) {}
96 87
97 Notification::~Notification() {} 88 Notification::~Notification() {}
98 89
99 Notification& Notification::operator=(const Notification& notification) { 90 Notification& Notification::operator=(const Notification& notification) {
100 message_center::Notification::operator=(notification); 91 message_center::Notification::operator=(notification);
101 origin_url_ = notification.origin_url(); 92 origin_url_ = notification.origin_url();
102 icon_url_ = notification.icon_url(); 93 icon_url_ = notification.icon_url();
103 content_url_ = notification.content_url();
104 button_one_icon_url_ = notification.button_one_icon_url(); 94 button_one_icon_url_ = notification.button_one_icon_url();
105 button_two_icon_url_ = notification.button_two_icon_url(); 95 button_two_icon_url_ = notification.button_two_icon_url();
106 image_url_ = notification.image_url(); 96 image_url_ = notification.image_url();
107 replace_id_ = notification.replace_id(); 97 replace_id_ = notification.replace_id();
108 delegate_ = notification.delegate(); 98 delegate_ = notification.delegate();
109 return *this; 99 return *this;
110 } 100 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698