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

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: Style nit 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 "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/download/download_crx_util.h" 9 #include "chrome/browser/download/download_crx_util.h"
10 #include "chrome/browser/download/download_item_model.h" 10 #include "chrome/browser/download/download_item_model.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 DownloadNotificationManagerForProfile* manager) 112 DownloadNotificationManagerForProfile* manager)
113 : item_(item), 113 : item_(item),
114 weak_factory_(this) { 114 weak_factory_(this) {
115 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 115 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
116 116
117 message_center::RichNotificationData data; 117 message_center::RichNotificationData data;
118 // Creates the notification instance. |title| and |body| will be overridden 118 // Creates the notification instance. |title| and |body| will be overridden
119 // by UpdateNotificationData() below. 119 // by UpdateNotificationData() below.
120 notification_.reset(new Notification( 120 notification_.reset(new Notification(
121 message_center::NOTIFICATION_TYPE_PROGRESS, 121 message_center::NOTIFICATION_TYPE_PROGRESS,
122 GURL(kDownloadNotificationOrigin), // origin_url 122 base::string16(), // title
123 base::string16(), // title 123 base::string16(), // body
124 base::string16(), // body
125 bundle.GetImageNamed(IDR_DOWNLOAD_NOTIFICATION_DOWNLOADING), 124 bundle.GetImageNamed(IDR_DOWNLOAD_NOTIFICATION_DOWNLOADING),
126 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 125 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
127 kDownloadNotificationNotifierId), 126 kDownloadNotificationNotifierId),
128 base::string16(), // display_source 127 base::string16(), // display_source
128 GURL(kDownloadNotificationOrigin), // origin_url
129 base::UintToString(item_->GetId()), // tag 129 base::UintToString(item_->GetId()), // tag
130 data, watcher())); 130 data, watcher()));
131 131
132 notification_->set_progress(0); 132 notification_->set_progress(0);
133 notification_->set_never_timeout(false); 133 notification_->set_never_timeout(false);
134 } 134 }
135 135
136 DownloadItemNotification::~DownloadItemNotification() { 136 DownloadItemNotification::~DownloadItemNotification() {
137 if (image_decode_status_ == IN_PROGRESS) 137 if (image_decode_status_ == IN_PROGRESS)
138 ImageDecoder::Cancel(this); 138 ImageDecoder::Cancel(this);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 profile_id); 668 profile_id);
669 669
670 message_center::NotificationList::Notifications visible_notifications = 670 message_center::NotificationList::Notifications visible_notifications =
671 g_browser_process->message_center()->GetVisibleNotifications(); 671 g_browser_process->message_center()->GetVisibleNotifications();
672 for (const auto& notification : visible_notifications) { 672 for (const auto& notification : visible_notifications) {
673 if (notification->id() == notification_id_in_message_center) 673 if (notification->id() == notification_id_in_message_center)
674 return true; 674 return true;
675 } 675 }
676 return false; 676 return false;
677 } 677 }
678
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698