| OLD | NEW |
| 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 "chrome/renderer/notification_provider.h" | 5 #include "chrome/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/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/common/render_messages_params.h" | 10 #include "chrome/common/render_messages_params.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return handled; | 100 return handled; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool NotificationProvider::ShowHTML(const WebNotification& notification, | 103 bool NotificationProvider::ShowHTML(const WebNotification& notification, |
| 104 int id) { | 104 int id) { |
| 105 // Disallow HTML notifications from unwanted schemes. javascript: | 105 // Disallow HTML notifications from unwanted schemes. javascript: |
| 106 // in particular allows unwanted cross-domain access. | 106 // in particular allows unwanted cross-domain access. |
| 107 GURL url = notification.url(); | 107 GURL url = notification.url(); |
| 108 if (!url.SchemeIs(chrome::kHttpScheme) && | 108 if (!url.SchemeIs(chrome::kHttpScheme) && |
| 109 !url.SchemeIs(chrome::kHttpsScheme) && | 109 !url.SchemeIs(chrome::kHttpsScheme) && |
| 110 !url.SchemeIs(chrome::kHttpsvScheme) && |
| 110 !url.SchemeIs(chrome::kExtensionScheme) && | 111 !url.SchemeIs(chrome::kExtensionScheme) && |
| 111 !url.SchemeIs(chrome::kDataScheme)) | 112 !url.SchemeIs(chrome::kDataScheme)) |
| 112 return false; | 113 return false; |
| 113 | 114 |
| 114 DCHECK(notification.isHTML()); | 115 DCHECK(notification.isHTML()); |
| 115 ViewHostMsg_ShowNotification_Params params; | 116 ViewHostMsg_ShowNotification_Params params; |
| 116 params.origin = | 117 params.origin = |
| 117 GURL(render_view()->webview()->mainFrame()->url()).GetOrigin(); | 118 GURL(render_view()->webview()->mainFrame()->url()).GetOrigin(); |
| 118 params.is_html = true; | 119 params.is_html = true; |
| 119 params.contents_url = notification.url(); | 120 params.contents_url = notification.url(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void NotificationProvider::OnPermissionRequestComplete(int id) { | 180 void NotificationProvider::OnPermissionRequestComplete(int id) { |
| 180 WebNotificationPermissionCallback* callback = manager_.GetCallback(id); | 181 WebNotificationPermissionCallback* callback = manager_.GetCallback(id); |
| 181 DCHECK(callback); | 182 DCHECK(callback); |
| 182 callback->permissionRequestComplete(); | 183 callback->permissionRequestComplete(); |
| 183 manager_.OnPermissionRequestComplete(id); | 184 manager_.OnPermissionRequestComplete(id); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void NotificationProvider::OnNavigate() { | 187 void NotificationProvider::OnNavigate() { |
| 187 manager_.Clear(); | 188 manager_.Clear(); |
| 188 } | 189 } |
| OLD | NEW |