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

Side by Side Diff: content/renderer/notification_provider.cc

Issue 6874038: Remove the last Chrome dependencies from renderer, and enforce no more includes through DEPS. I ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "content/renderer/notification_provider.h" 5 #include "content/renderer/notification_provider.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/common/url_constants.h"
10 #include "chrome/common/render_messages.h"
11 #include "content/common/desktop_notification_messages.h" 9 #include "content/common/desktop_notification_messages.h"
12 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
13 #include "content/renderer/render_thread.h" 11 #include "content/renderer/render_thread.h"
14 #include "content/renderer/render_view.h" 12 #include "content/renderer/render_view.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPermis sionCallback.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPermis sionCallback.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
20 18
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 IPC_END_MESSAGE_MAP() 93 IPC_END_MESSAGE_MAP()
96 94
97 if (message.type() == ViewMsg_Navigate::ID) 95 if (message.type() == ViewMsg_Navigate::ID)
98 OnNavigate(); // Don't want to swallow the message. 96 OnNavigate(); // Don't want to swallow the message.
99 97
100 return handled; 98 return handled;
101 } 99 }
102 100
103 bool NotificationProvider::ShowHTML(const WebNotification& notification, 101 bool NotificationProvider::ShowHTML(const WebNotification& notification,
104 int id) { 102 int id) {
105 // Disallow HTML notifications from unwanted schemes. javascript:
106 // in particular allows unwanted cross-domain access.
107 GURL url = notification.url();
108 if (!url.SchemeIs(chrome::kHttpScheme) &&
109 !url.SchemeIs(chrome::kHttpsScheme) &&
110 !url.SchemeIs(chrome::kExtensionScheme) &&
111 !url.SchemeIs(chrome::kDataScheme))
112 return false;
113
114 DCHECK(notification.isHTML()); 103 DCHECK(notification.isHTML());
115 DesktopNotificationHostMsg_Show_Params params; 104 DesktopNotificationHostMsg_Show_Params params;
116 params.origin = 105 params.origin =
117 GURL(render_view()->webview()->mainFrame()->url()).GetOrigin(); 106 GURL(render_view()->webview()->mainFrame()->url()).GetOrigin();
118 params.is_html = true; 107 params.is_html = true;
119 params.contents_url = notification.url(); 108 params.contents_url = notification.url();
120 params.notification_id = id; 109 params.notification_id = id;
121 params.replace_id = notification.replaceId(); 110 params.replace_id = notification.replaceId();
122 return Send(new DesktopNotificationHostMsg_Show(routing_id(), params)); 111 return Send(new DesktopNotificationHostMsg_Show(routing_id(), params));
123 } 112 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void NotificationProvider::OnPermissionRequestComplete(int id) { 168 void NotificationProvider::OnPermissionRequestComplete(int id) {
180 WebNotificationPermissionCallback* callback = manager_.GetCallback(id); 169 WebNotificationPermissionCallback* callback = manager_.GetCallback(id);
181 DCHECK(callback); 170 DCHECK(callback);
182 callback->permissionRequestComplete(); 171 callback->permissionRequestComplete();
183 manager_.OnPermissionRequestComplete(id); 172 manager_.OnPermissionRequestComplete(id);
184 } 173 }
185 174
186 void NotificationProvider::OnNavigate() { 175 void NotificationProvider::OnNavigate() {
187 manager_.Clear(); 176 manager_.Clear();
188 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698