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

Side by Side Diff: chrome/browser/desktop_notification_handler.cc

Issue 7053041: Add a Create method to DesktopNotificationHandler and stubs for the notification objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/desktop_notification_handler.h" 5 #include "chrome/browser/desktop_notification_handler.h"
6 6
7 #include "chrome/browser/notifications/desktop_notification_service.h" 7 #include "chrome/browser/notifications/desktop_notification_service.h"
8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "content/browser/renderer_host/render_process_host.h" 11 #include "content/browser/renderer_host/render_process_host.h"
12 #include "content/browser/renderer_host/render_view_host.h" 12 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/browser/renderer_host/render_view_host_delegate.h" 13 #include "content/browser/renderer_host/render_view_host_delegate.h"
14 #include "content/common/desktop_notification_messages.h" 14 #include "content/common/desktop_notification_messages.h"
15 15
16 // static
17 DesktopNotificationHandler*
18 DesktopNotificationHandler::Create(RenderViewHost* render_view_host) {
19 return new DesktopNotificationHandler(render_view_host);
20 }
21
22 DesktopNotificationHandler::~DesktopNotificationHandler() {
23 }
24
16 DesktopNotificationHandler::DesktopNotificationHandler( 25 DesktopNotificationHandler::DesktopNotificationHandler(
17 RenderViewHost* render_view_host) 26 RenderViewHost* render_view_host)
18 : RenderViewHostObserver(render_view_host) { 27 : RenderViewHostObserver(render_view_host) {
19 } 28 }
20 29
21 DesktopNotificationHandler::~DesktopNotificationHandler() {
22 }
23
24 bool DesktopNotificationHandler::OnMessageReceived( 30 bool DesktopNotificationHandler::OnMessageReceived(
25 const IPC::Message& message) { 31 const IPC::Message& message) {
26 bool handled = true; 32 bool handled = true;
27 33
28 IPC_BEGIN_MESSAGE_MAP(DesktopNotificationHandler, message) 34 IPC_BEGIN_MESSAGE_MAP(DesktopNotificationHandler, message)
29 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, OnShow) 35 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, OnShow)
30 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, OnCancel) 36 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, OnCancel)
31 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, 37 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission,
32 OnRequestPermission) 38 OnRequestPermission)
33 IPC_MESSAGE_UNHANDLED(handled = false) 39 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 source_origin, callback_context)) { 83 source_origin, callback_context)) {
78 return; 84 return;
79 } 85 }
80 86
81 RenderProcessHost* process = render_view_host()->process(); 87 RenderProcessHost* process = render_view_host()->process();
82 DesktopNotificationService* service = 88 DesktopNotificationService* service =
83 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 89 DesktopNotificationServiceFactory::GetForProfile(process->profile());
84 service->RequestPermission( 90 service->RequestPermission(
85 source_origin, process->id(), routing_id(), callback_context, NULL); 91 source_origin, process->id(), routing_id(), callback_context, NULL);
86 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698