OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 callback)); | 152 callback)); |
153 } | 153 } |
154 | 154 |
155 void DesktopNotificationService::ShowDesktopNotification( | 155 void DesktopNotificationService::ShowDesktopNotification( |
156 const content::ShowDesktopNotificationHostMsgParams& params, | 156 const content::ShowDesktopNotificationHostMsgParams& params, |
157 content::RenderFrameHost* render_frame_host, | 157 content::RenderFrameHost* render_frame_host, |
158 scoped_ptr<content::DesktopNotificationDelegate> delegate, | 158 scoped_ptr<content::DesktopNotificationDelegate> delegate, |
159 base::Closure* cancel_callback) { | 159 base::Closure* cancel_callback) { |
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
161 const GURL& origin = params.origin; | 161 const GURL& origin = params.origin; |
162 NotificationObjectProxy* proxy = | 162 NotificationObjectProxy* proxy = new NotificationObjectProxy(delegate.Pass()); |
163 new NotificationObjectProxy(render_frame_host, delegate.Pass()); | |
164 | 163 |
165 base::string16 display_source = DisplayNameForOriginInProcessId( | 164 base::string16 display_source = DisplayNameForOriginInProcessId( |
166 origin, render_frame_host->GetProcess()->GetID()); | 165 origin, render_frame_host->GetProcess()->GetID()); |
167 | 166 |
168 // TODO(peter): Icons for Web Notifications are currently always requested for | 167 // TODO(peter): Icons for Web Notifications are currently always requested for |
169 // 1x scale, whereas the displays on which they can be displayed can have a | 168 // 1x scale, whereas the displays on which they can be displayed can have a |
170 // different pixel density. Be smarter about this when the API gets updated | 169 // different pixel density. Be smarter about this when the API gets updated |
171 // with a way for developers to specify images of different resolutions. | 170 // with a way for developers to specify images of different resolutions. |
172 Notification notification(origin, params.title, params.body, | 171 Notification notification(origin, params.title, params.body, |
173 gfx::Image::CreateFrom1xBitmap(params.icon), | 172 gfx::Image::CreateFrom1xBitmap(params.icon), |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // Tell the IO thread that this extension's permission for notifications | 353 // Tell the IO thread that this extension's permission for notifications |
355 // has changed. | 354 // has changed. |
356 extensions::InfoMap* extension_info_map = | 355 extensions::InfoMap* extension_info_map = |
357 extensions::ExtensionSystem::Get(profile_)->info_map(); | 356 extensions::ExtensionSystem::Get(profile_)->info_map(); |
358 BrowserThread::PostTask( | 357 BrowserThread::PostTask( |
359 BrowserThread::IO, FROM_HERE, | 358 BrowserThread::IO, FROM_HERE, |
360 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 359 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
361 extension_info_map, notifier_id.id, !enabled)); | 360 extension_info_map, notifier_id.id, !enabled)); |
362 #endif | 361 #endif |
363 } | 362 } |
OLD | NEW |