| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); | 1138 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); |
| 1139 remote_interfaces_.reset(new service_manager::InterfaceProvider); | 1139 remote_interfaces_.reset(new service_manager::InterfaceProvider); |
| 1140 remote_interfaces_->Bind(std::move(remote_interfaces)); | 1140 remote_interfaces_->Bind(std::move(remote_interfaces)); |
| 1141 blink_interface_provider_.reset(new BlinkInterfaceProviderImpl( | 1141 blink_interface_provider_.reset(new BlinkInterfaceProviderImpl( |
| 1142 remote_interfaces_->GetWeakPtr())); | 1142 remote_interfaces_->GetWeakPtr())); |
| 1143 blink_interface_registry_.reset( | 1143 blink_interface_registry_.reset( |
| 1144 new BlinkInterfaceRegistryImpl(interface_registry_->GetWeakPtr())); | 1144 new BlinkInterfaceRegistryImpl(interface_registry_->GetWeakPtr())); |
| 1145 | 1145 |
| 1146 std::pair<RoutingIDFrameMap::iterator, bool> result = | 1146 std::pair<RoutingIDFrameMap::iterator, bool> result = |
| 1147 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 1147 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
| 1148 CHECK(result.second) << "Inserting a duplicate item."; | 1148 // Inserting a duplicate item. |
| 1149 CHECK(result.second); |
| 1149 | 1150 |
| 1150 RenderThread::Get()->AddRoute(routing_id_, this); | 1151 RenderThread::Get()->AddRoute(routing_id_, this); |
| 1151 | 1152 |
| 1152 render_view_->RegisterRenderFrame(this); | 1153 render_view_->RegisterRenderFrame(this); |
| 1153 | 1154 |
| 1154 // Everything below subclasses RenderFrameObserver and is automatically | 1155 // Everything below subclasses RenderFrameObserver and is automatically |
| 1155 // deleted when the RenderFrame gets deleted. | 1156 // deleted when the RenderFrame gets deleted. |
| 1156 #if defined(OS_ANDROID) | 1157 #if defined(OS_ANDROID) |
| 1157 new GinJavaBridgeDispatcher(this); | 1158 new GinJavaBridgeDispatcher(this); |
| 1158 #endif | 1159 #endif |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 render_view_->UnregisterRenderFrame(this); | 1213 render_view_->UnregisterRenderFrame(this); |
| 1213 g_routing_id_frame_map.Get().erase(routing_id_); | 1214 g_routing_id_frame_map.Get().erase(routing_id_); |
| 1214 RenderThread::Get()->RemoveRoute(routing_id_); | 1215 RenderThread::Get()->RemoveRoute(routing_id_); |
| 1215 } | 1216 } |
| 1216 | 1217 |
| 1217 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) { | 1218 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) { |
| 1218 DCHECK(!frame_); | 1219 DCHECK(!frame_); |
| 1219 | 1220 |
| 1220 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( | 1221 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( |
| 1221 std::make_pair(web_frame, this)); | 1222 std::make_pair(web_frame, this)); |
| 1222 CHECK(result.second) << "Inserting a duplicate item."; | 1223 // Inserting a duplicate item. |
| 1224 CHECK(result.second); |
| 1223 | 1225 |
| 1224 frame_ = web_frame; | 1226 frame_ = web_frame; |
| 1225 } | 1227 } |
| 1226 | 1228 |
| 1227 void RenderFrameImpl::Initialize() { | 1229 void RenderFrameImpl::Initialize() { |
| 1228 is_main_frame_ = !frame_->parent(); | 1230 is_main_frame_ = !frame_->parent(); |
| 1229 | 1231 |
| 1230 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( | 1232 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( |
| 1231 frame_->parent()); | 1233 frame_->parent()); |
| 1232 if (parent_frame) { | 1234 if (parent_frame) { |
| (...skipping 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4944 base::debug::SetCrashKeyValue("origin_mismatch_url", params.url.spec()); | 4946 base::debug::SetCrashKeyValue("origin_mismatch_url", params.url.spec()); |
| 4945 base::debug::SetCrashKeyValue("origin_mismatch_origin", | 4947 base::debug::SetCrashKeyValue("origin_mismatch_origin", |
| 4946 params.origin.Serialize()); | 4948 params.origin.Serialize()); |
| 4947 base::debug::SetCrashKeyValue("origin_mismatch_transition", | 4949 base::debug::SetCrashKeyValue("origin_mismatch_transition", |
| 4948 base::IntToString(params.transition)); | 4950 base::IntToString(params.transition)); |
| 4949 base::debug::SetCrashKeyValue("origin_mismatch_redirects", | 4951 base::debug::SetCrashKeyValue("origin_mismatch_redirects", |
| 4950 base::IntToString(params.redirects.size())); | 4952 base::IntToString(params.redirects.size())); |
| 4951 base::debug::SetCrashKeyValue( | 4953 base::debug::SetCrashKeyValue( |
| 4952 "origin_mismatch_same_page", | 4954 "origin_mismatch_same_page", |
| 4953 base::IntToString(params.was_within_same_page)); | 4955 base::IntToString(params.was_within_same_page)); |
| 4954 CHECK(params.origin.IsSamePhysicalOriginWith(url::Origin(params.url))) | 4956 CHECK(params.origin.IsSamePhysicalOriginWith(url::Origin(params.url))); |
| 4955 << " url:" << params.url << " origin:" << params.origin; | |
| 4956 } | 4957 } |
| 4957 } | 4958 } |
| 4958 | 4959 |
| 4959 // This message needs to be sent before any of allowScripts(), | 4960 // This message needs to be sent before any of allowScripts(), |
| 4960 // allowImages(), allowPlugins() is called for the new page, so that when | 4961 // allowImages(), allowPlugins() is called for the new page, so that when |
| 4961 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 4962 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
| 4962 // after the FrameHostMsg_DidCommitProvisionalLoad message. | 4963 // after the FrameHostMsg_DidCommitProvisionalLoad message. |
| 4963 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 4964 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
| 4964 | 4965 |
| 4965 // If we end up reusing this WebRequest (for example, due to a #ref click), | 4966 // If we end up reusing this WebRequest (for example, due to a #ref click), |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6178 bool replace = load_type == WebFrameLoadType::ReloadBypassingCache || | 6179 bool replace = load_type == WebFrameLoadType::ReloadBypassingCache || |
| 6179 load_type == WebFrameLoadType::Reload; | 6180 load_type == WebFrameLoadType::Reload; |
| 6180 | 6181 |
| 6181 frame->loadData( | 6182 frame->loadData( |
| 6182 WebData(data.c_str(), data.length()), WebString::fromUTF8(mime_type), | 6183 WebData(data.c_str(), data.length()), WebString::fromUTF8(mime_type), |
| 6183 WebString::fromUTF8(charset), base_url, | 6184 WebString::fromUTF8(charset), base_url, |
| 6184 // Needed so that history-url-only changes don't become reloads. | 6185 // Needed so that history-url-only changes don't become reloads. |
| 6185 params.history_url_for_data_url, replace, load_type, | 6186 params.history_url_for_data_url, replace, load_type, |
| 6186 item_for_history_navigation, history_load_type, is_client_redirect); | 6187 item_for_history_navigation, history_load_type, is_client_redirect); |
| 6187 } else { | 6188 } else { |
| 6188 CHECK(false) << "Invalid URL passed: " | 6189 // Invalid URL passed. |
| 6189 << params.url.possibly_invalid_spec(); | 6190 CHECK(false); |
| 6190 } | 6191 } |
| 6191 } | 6192 } |
| 6192 | 6193 |
| 6193 void RenderFrameImpl::SendUpdateState() { | 6194 void RenderFrameImpl::SendUpdateState() { |
| 6194 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | 6195 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
| 6195 if (current_history_item_.isNull()) | 6196 if (current_history_item_.isNull()) |
| 6196 return; | 6197 return; |
| 6197 | 6198 |
| 6198 Send(new FrameHostMsg_UpdateState( | 6199 Send(new FrameHostMsg_UpdateState( |
| 6199 routing_id_, SingleHistoryItemToPageState(current_history_item_))); | 6200 routing_id_, SingleHistoryItemToPageState(current_history_item_))); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6679 // event target. Potentially a Pepper plugin will receive the event. | 6680 // event target. Potentially a Pepper plugin will receive the event. |
| 6680 // In order to tell whether a plugin gets the last mouse event and which it | 6681 // In order to tell whether a plugin gets the last mouse event and which it |
| 6681 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6682 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6682 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6683 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6683 // |pepper_last_mouse_event_target_|. | 6684 // |pepper_last_mouse_event_target_|. |
| 6684 pepper_last_mouse_event_target_ = nullptr; | 6685 pepper_last_mouse_event_target_ = nullptr; |
| 6685 #endif | 6686 #endif |
| 6686 } | 6687 } |
| 6687 | 6688 |
| 6688 } // namespace content | 6689 } // namespace content |
| OLD | NEW |