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

Side by Side Diff: chrome/browser/download/notification/download_item_notification.cc

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move origin_url to message_center::Notification Created 5 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/download/notification/download_item_notification.h" 5 #include "chrome/browser/download/notification/download_item_notification.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/download/download_crx_util.h" 10 #include "chrome/browser/download/download_crx_util.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 DownloadNotificationManagerForProfile* manager) 114 DownloadNotificationManagerForProfile* manager)
115 : item_(item), 115 : item_(item),
116 weak_factory_(this) { 116 weak_factory_(this) {
117 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 117 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
118 118
119 message_center::RichNotificationData data; 119 message_center::RichNotificationData data;
120 // Creates the notification instance. |title| and |body| will be overridden 120 // Creates the notification instance. |title| and |body| will be overridden
121 // by UpdateNotificationData() below. 121 // by UpdateNotificationData() below.
122 notification_.reset(new Notification( 122 notification_.reset(new Notification(
123 message_center::NOTIFICATION_TYPE_PROGRESS, 123 message_center::NOTIFICATION_TYPE_PROGRESS,
124 GURL(kDownloadNotificationOrigin), // origin_url 124 base::string16(), // title
125 base::string16(), // title 125 base::string16(), // body
126 base::string16(), // body
127 bundle.GetImageNamed(IDR_DOWNLOAD_NOTIFICATION_DOWNLOADING), 126 bundle.GetImageNamed(IDR_DOWNLOAD_NOTIFICATION_DOWNLOADING),
128 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 127 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
129 kDownloadNotificationNotifierId), 128 kDownloadNotificationNotifierId),
130 base::string16(), // display_source 129 base::string16(), // display_source
130 GURL(kDownloadNotificationOrigin), // origin_url
131 base::UintToString(item_->GetId()), // tag 131 base::UintToString(item_->GetId()), // tag
132 data, watcher())); 132 data, watcher()));
133 133
134 notification_->set_progress(0); 134 notification_->set_progress(0);
135 notification_->set_never_timeout(false); 135 notification_->set_never_timeout(false);
136 } 136 }
137 137
138 DownloadItemNotification::~DownloadItemNotification() { 138 DownloadItemNotification::~DownloadItemNotification() {
139 if (image_decode_status_ == IN_PROGRESS) 139 if (image_decode_status_ == IN_PROGRESS)
140 ImageDecoder::Cancel(this); 140 ImageDecoder::Cancel(this);
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 profile_id); 772 profile_id);
773 773
774 message_center::NotificationList::Notifications visible_notifications = 774 message_center::NotificationList::Notifications visible_notifications =
775 g_browser_process->message_center()->GetVisibleNotifications(); 775 g_browser_process->message_center()->GetVisibleNotifications();
776 for (const auto& notification : visible_notifications) { 776 for (const auto& notification : visible_notifications) {
777 if (notification->id() == notification_id_in_message_center) 777 if (notification->id() == notification_id_in_message_center)
778 return true; 778 return true;
779 } 779 }
780 return false; 780 return false;
781 } 781 }
782
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698