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 "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 bool swapped_out, | 160 bool swapped_out, |
161 SessionStorageNamespace* session_storage) | 161 SessionStorageNamespace* session_storage) |
162 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id), | 162 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id), |
163 delegate_(delegate), | 163 delegate_(delegate), |
164 instance_(static_cast<SiteInstanceImpl*>(instance)), | 164 instance_(static_cast<SiteInstanceImpl*>(instance)), |
165 waiting_for_drag_context_response_(false), | 165 waiting_for_drag_context_response_(false), |
166 enabled_bindings_(0), | 166 enabled_bindings_(0), |
167 pending_request_id_(-1), | 167 pending_request_id_(-1), |
168 navigations_suspended_(false), | 168 navigations_suspended_(false), |
169 suspended_nav_params_(NULL), | 169 suspended_nav_params_(NULL), |
170 has_accessed_initial_document_(false), | |
171 is_swapped_out_(swapped_out), | 170 is_swapped_out_(swapped_out), |
172 is_subframe_(false), | 171 is_subframe_(false), |
173 run_modal_reply_msg_(NULL), | 172 run_modal_reply_msg_(NULL), |
174 run_modal_opener_id_(MSG_ROUTING_NONE), | 173 run_modal_opener_id_(MSG_ROUTING_NONE), |
175 is_waiting_for_beforeunload_ack_(false), | 174 is_waiting_for_beforeunload_ack_(false), |
176 is_waiting_for_unload_ack_(false), | 175 is_waiting_for_unload_ack_(false), |
177 has_timed_out_on_unload_(false), | 176 has_timed_out_on_unload_(false), |
178 unload_ack_is_for_cross_site_transition_(false), | 177 unload_ack_is_for_cross_site_transition_(false), |
179 are_javascript_messages_suppressed_(false), | 178 are_javascript_messages_suppressed_(false), |
180 accessibility_layout_callback_(base::Bind(&base::DoNothing)), | 179 accessibility_layout_callback_(base::Bind(&base::DoNothing)), |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 980 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
982 OnRequestDesktopNotificationPermission) | 981 OnRequestDesktopNotificationPermission) |
983 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 982 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
984 OnShowDesktopNotification) | 983 OnShowDesktopNotification) |
985 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 984 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
986 OnCancelDesktopNotification) | 985 OnCancelDesktopNotification) |
987 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 986 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
988 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) | 987 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) |
989 #endif | 988 #endif |
990 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 989 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
991 IPC_MESSAGE_HANDLER(ViewHostMsg_DidAccessInitialDocument, | |
992 OnDidAccessInitialDocument) | |
993 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 990 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |
994 OnDomOperationResponse) | 991 OnDomOperationResponse) |
995 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, | 992 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, |
996 OnAccessibilityNotifications) | 993 OnAccessibilityNotifications) |
997 // Have the super handle all other messages. | 994 // Have the super handle all other messages. |
998 IPC_MESSAGE_UNHANDLED( | 995 IPC_MESSAGE_UNHANDLED( |
999 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 996 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
1000 IPC_END_MESSAGE_MAP_EX() | 997 IPC_END_MESSAGE_MAP_EX() |
1001 | 998 |
1002 if (!msg_is_ok) { | 999 if (!msg_is_ok) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(), | 1196 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(), |
1200 GetSiteInstance()->GetSiteURL(), | 1197 GetSiteInstance()->GetSiteURL(), |
1201 validated_params.url) || | 1198 validated_params.url) || |
1202 static_cast<SiteInstanceImpl*>(GetSiteInstance())-> | 1199 static_cast<SiteInstanceImpl*>(GetSiteInstance())-> |
1203 HasWrongProcessForURL(validated_params.url)) { | 1200 HasWrongProcessForURL(validated_params.url)) { |
1204 // TODO(nasko): Removed the actual kill process call until out-of-process | 1201 // TODO(nasko): Removed the actual kill process call until out-of-process |
1205 // iframes is ready to go. | 1202 // iframes is ready to go. |
1206 } | 1203 } |
1207 } | 1204 } |
1208 | 1205 |
1209 // Now that something has committed, we don't need to track whether the | |
1210 // initial page has been accessed. | |
1211 has_accessed_initial_document_ = false; | |
1212 | |
1213 ChildProcessSecurityPolicyImpl* policy = | 1206 ChildProcessSecurityPolicyImpl* policy = |
1214 ChildProcessSecurityPolicyImpl::GetInstance(); | 1207 ChildProcessSecurityPolicyImpl::GetInstance(); |
1215 // Without this check, an evil renderer can trick the browser into creating | 1208 // Without this check, an evil renderer can trick the browser into creating |
1216 // a navigation entry for a banned URL. If the user clicks the back button | 1209 // a navigation entry for a banned URL. If the user clicks the back button |
1217 // followed by the forward button (or clicks reload, or round-trips through | 1210 // followed by the forward button (or clicks reload, or round-trips through |
1218 // session restore, etc), we'll think that the browser commanded the | 1211 // session restore, etc), we'll think that the browser commanded the |
1219 // renderer to load the URL and grant the renderer the privileges to request | 1212 // renderer to load the URL and grant the renderer the privileges to request |
1220 // the URL. To prevent this attack, we block the renderer from inserting | 1213 // the URL. To prevent this attack, we block the renderer from inserting |
1221 // banned URLs into the navigation controller in the first place. | 1214 // banned URLs into the navigation controller in the first place. |
1222 FilterURL(policy, process, false, &validated_params.url); | 1215 FilterURL(policy, process, false, &validated_params.url); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 | 1971 |
1979 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) { | 1972 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) { |
1980 GetContentClient()->browser()->CancelDesktopNotification( | 1973 GetContentClient()->browser()->CancelDesktopNotification( |
1981 GetProcess()->GetID(), GetRoutingID(), notification_id); | 1974 GetProcess()->GetID(), GetRoutingID(), notification_id); |
1982 } | 1975 } |
1983 | 1976 |
1984 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { | 1977 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { |
1985 delegate_->RunFileChooser(this, params); | 1978 delegate_->RunFileChooser(this, params); |
1986 } | 1979 } |
1987 | 1980 |
1988 void RenderViewHostImpl::OnDidAccessInitialDocument() { | |
1989 has_accessed_initial_document_ = true; | |
1990 delegate_->DidAccessInitialDocument(); | |
1991 } | |
1992 | |
1993 void RenderViewHostImpl::OnDomOperationResponse( | 1981 void RenderViewHostImpl::OnDomOperationResponse( |
1994 const std::string& json_string, int automation_id) { | 1982 const std::string& json_string, int automation_id) { |
1995 DomOperationNotificationDetails details(json_string, automation_id); | 1983 DomOperationNotificationDetails details(json_string, automation_id); |
1996 NotificationService::current()->Notify( | 1984 NotificationService::current()->Notify( |
1997 NOTIFICATION_DOM_OPERATION_RESPONSE, | 1985 NOTIFICATION_DOM_OPERATION_RESPONSE, |
1998 Source<RenderViewHost>(this), | 1986 Source<RenderViewHost>(this), |
1999 Details<DomOperationNotificationDetails>(&details)); | 1987 Details<DomOperationNotificationDetails>(&details)); |
2000 } | 1988 } |
2001 | 1989 |
2002 void RenderViewHostImpl::OnGetWindowSnapshot(const int snapshot_id) { | 1990 void RenderViewHostImpl::OnGetWindowSnapshot(const int snapshot_id) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 is_waiting_for_beforeunload_ack_ = false; | 2035 is_waiting_for_beforeunload_ack_ = false; |
2048 is_waiting_for_unload_ack_ = false; | 2036 is_waiting_for_unload_ack_ = false; |
2049 has_timed_out_on_unload_ = false; | 2037 has_timed_out_on_unload_ = false; |
2050 } | 2038 } |
2051 | 2039 |
2052 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 2040 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
2053 STLDeleteValues(&power_save_blockers_); | 2041 STLDeleteValues(&power_save_blockers_); |
2054 } | 2042 } |
2055 | 2043 |
2056 } // namespace content | 2044 } // namespace content |
OLD | NEW |