OLD | NEW |
---|---|
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 DesktopNotificationHandler::DesktopNotificationHandler( | 16 DesktopNotificationHandler::DesktopNotificationHandler( |
17 RenderViewHost* render_view_host) | 17 RenderViewHost* render_view_host) |
18 : RenderViewHostObserver(render_view_host) { | 18 : RenderViewHostObserver(render_view_host) { |
19 } | 19 } |
20 | 20 |
21 DesktopNotificationHandler::~DesktopNotificationHandler() { | 21 DesktopNotificationHandler::~DesktopNotificationHandler() { |
22 } | 22 } |
23 | 23 |
24 // static | |
Torne
2011/06/02 16:18:35
Reorder the constructor/create method in this file
| |
25 DesktopNotificationHandler* | |
26 DesktopNotificationHandler::Create(RenderViewHost* render_view_host) { | |
27 return new DesktopNotificationHandler(render_view_host); | |
28 } | |
29 | |
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 Loading... | |
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 } |
OLD | NEW |