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

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

Issue 554213003: Request the icon of a Web Notification in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes now redundant code 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 | « no previous file | chrome/browser/notifications/message_center_notification_manager.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/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 content::RenderFrameHost* render_frame_host, 150 content::RenderFrameHost* render_frame_host,
151 scoped_ptr<content::DesktopNotificationDelegate> delegate, 151 scoped_ptr<content::DesktopNotificationDelegate> delegate,
152 base::Closure* cancel_callback) { 152 base::Closure* cancel_callback) {
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
154 const GURL& origin = params.origin; 154 const GURL& origin = params.origin;
155 NotificationObjectProxy* proxy = 155 NotificationObjectProxy* proxy =
156 new NotificationObjectProxy(render_frame_host, delegate.Pass()); 156 new NotificationObjectProxy(render_frame_host, delegate.Pass());
157 157
158 base::string16 display_source = DisplayNameForOriginInProcessId( 158 base::string16 display_source = DisplayNameForOriginInProcessId(
159 origin, render_frame_host->GetProcess()->GetID()); 159 origin, render_frame_host->GetProcess()->GetID());
160 Notification notification(origin, params.icon_url, params.title, 160
161 params.body, params.direction, display_source, params.replace_id, 161 Notification notification(origin,
162 proxy); 162 gfx::Image::CreateFrom1xBitmap(params.icon),
dewittj 2014/09/17 16:36:20 I think that today, this will work for 1x and 2x d
Jun Mukai 2014/09/17 16:57:47 Using CreateFrom1xBitmap is not bad by itself, it
Peter Beverloo 2014/09/18 16:54:37 I agree that it would be good for the Notification
163 params.title,
164 params.body,
165 params.direction,
166 display_source,
167 params.replace_id,
168 proxy);
163 169
164 // The webkit notification doesn't timeout. 170 // The webkit notification doesn't timeout.
165 notification.set_never_timeout(true); 171 notification.set_never_timeout(true);
166 172
167 g_browser_process->notification_ui_manager()->Add(notification, profile_); 173 g_browser_process->notification_ui_manager()->Add(notification, profile_);
168 if (cancel_callback) 174 if (cancel_callback)
169 *cancel_callback = base::Bind(&CancelNotification, proxy->id()); 175 *cancel_callback = base::Bind(&CancelNotification, proxy->id());
170 176
171 DesktopNotificationProfileUtil::UsePermission(profile_, origin); 177 DesktopNotificationProfileUtil::UsePermission(profile_, origin);
172 } 178 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Tell the IO thread that this extension's permission for notifications 341 // Tell the IO thread that this extension's permission for notifications
336 // has changed. 342 // has changed.
337 extensions::InfoMap* extension_info_map = 343 extensions::InfoMap* extension_info_map =
338 extensions::ExtensionSystem::Get(profile_)->info_map(); 344 extensions::ExtensionSystem::Get(profile_)->info_map();
339 BrowserThread::PostTask( 345 BrowserThread::PostTask(
340 BrowserThread::IO, FROM_HERE, 346 BrowserThread::IO, FROM_HERE,
341 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 347 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
342 extension_info_map, notifier_id.id, !enabled)); 348 extension_info_map, notifier_id.id, !enabled));
343 #endif 349 #endif
344 } 350 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/message_center_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698