| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 RenderFrameImpl::~RenderFrameImpl() { | 1157 RenderFrameImpl::~RenderFrameImpl() { |
| 1158 // If file chooser is still waiting for answer, dispatch empty answer. | 1158 // If file chooser is still waiting for answer, dispatch empty answer. |
| 1159 while (!file_chooser_completions_.empty()) { | 1159 while (!file_chooser_completions_.empty()) { |
| 1160 if (file_chooser_completions_.front()->completion) { | 1160 if (file_chooser_completions_.front()->completion) { |
| 1161 file_chooser_completions_.front()->completion->didChooseFile( | 1161 file_chooser_completions_.front()->completion->didChooseFile( |
| 1162 WebVector<WebString>()); | 1162 WebVector<WebString>()); |
| 1163 } | 1163 } |
| 1164 file_chooser_completions_.pop_front(); | 1164 file_chooser_completions_.pop_front(); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); | 1167 for (auto& observer : observers_) |
| 1168 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); | 1168 observer.RenderFrameGone(); |
| 1169 for (auto& observer : observers_) |
| 1170 observer.OnDestruct(); |
| 1169 | 1171 |
| 1170 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); | 1172 base::trace_event::TraceLog::GetInstance()->RemoveProcessLabel(routing_id_); |
| 1171 | 1173 |
| 1172 // Unregister from InputHandlerManager. render_thread may be NULL in tests. | 1174 // Unregister from InputHandlerManager. render_thread may be NULL in tests. |
| 1173 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 1175 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 1174 InputHandlerManager* input_handler_manager = | 1176 InputHandlerManager* input_handler_manager = |
| 1175 render_thread ? render_thread->input_handler_manager() : nullptr; | 1177 render_thread ? render_thread->input_handler_manager() : nullptr; |
| 1176 if (input_handler_manager) | 1178 if (input_handler_manager) |
| 1177 input_handler_manager->UnregisterRoutingID(GetRoutingID()); | 1179 input_handler_manager->UnregisterRoutingID(GetRoutingID()); |
| 1178 | 1180 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1262 } |
| 1261 | 1263 |
| 1262 RenderWidget* RenderFrameImpl::GetRenderWidget() { | 1264 RenderWidget* RenderFrameImpl::GetRenderWidget() { |
| 1263 RenderFrameImpl* local_root = | 1265 RenderFrameImpl* local_root = |
| 1264 RenderFrameImpl::FromWebFrame(frame_->localRoot()); | 1266 RenderFrameImpl::FromWebFrame(frame_->localRoot()); |
| 1265 return local_root->render_widget_.get(); | 1267 return local_root->render_widget_.get(); |
| 1266 } | 1268 } |
| 1267 | 1269 |
| 1268 #if defined(ENABLE_PLUGINS) | 1270 #if defined(ENABLE_PLUGINS) |
| 1269 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { | 1271 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { |
| 1270 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 1272 for (auto& observer : observers_) |
| 1271 DidCreatePepperPlugin(host)); | 1273 observer.DidCreatePepperPlugin(host); |
| 1272 } | 1274 } |
| 1273 | 1275 |
| 1274 void RenderFrameImpl::PepperDidChangeCursor( | 1276 void RenderFrameImpl::PepperDidChangeCursor( |
| 1275 PepperPluginInstanceImpl* instance, | 1277 PepperPluginInstanceImpl* instance, |
| 1276 const blink::WebCursorInfo& cursor) { | 1278 const blink::WebCursorInfo& cursor) { |
| 1277 // Update the cursor appearance immediately if the requesting plugin is the | 1279 // Update the cursor appearance immediately if the requesting plugin is the |
| 1278 // one which receives the last mouse event. Otherwise, the new cursor won't be | 1280 // one which receives the last mouse event. Otherwise, the new cursor won't be |
| 1279 // picked up until the plugin gets the next input event. That is bad if, e.g., | 1281 // picked up until the plugin gets the next input event. That is bad if, e.g., |
| 1280 // the plugin would like to set an invisible cursor when there isn't any user | 1282 // the plugin would like to set an invisible cursor when there isn't any user |
| 1281 // input for a while. | 1283 // input for a while. |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 // an accessibility mode change but the frame is persisting. | 2137 // an accessibility mode change but the frame is persisting. |
| 2136 render_accessibility_->DisableAccessibility(); | 2138 render_accessibility_->DisableAccessibility(); |
| 2137 | 2139 |
| 2138 delete render_accessibility_; | 2140 delete render_accessibility_; |
| 2139 render_accessibility_ = NULL; | 2141 render_accessibility_ = NULL; |
| 2140 } | 2142 } |
| 2141 | 2143 |
| 2142 if (accessibility_mode_ & AccessibilityModeFlagFullTree) | 2144 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 2143 render_accessibility_ = new RenderAccessibilityImpl(this); | 2145 render_accessibility_ = new RenderAccessibilityImpl(this); |
| 2144 | 2146 |
| 2145 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 2147 for (auto& observer : observers_) |
| 2146 AccessibilityModeChanged()); | 2148 observer.AccessibilityModeChanged(); |
| 2147 } | 2149 } |
| 2148 | 2150 |
| 2149 void RenderFrameImpl::OnSnapshotAccessibilityTree(int callback_id) { | 2151 void RenderFrameImpl::OnSnapshotAccessibilityTree(int callback_id) { |
| 2150 AXContentTreeUpdate response; | 2152 AXContentTreeUpdate response; |
| 2151 RenderAccessibilityImpl::SnapshotAccessibilityTree(this, &response); | 2153 RenderAccessibilityImpl::SnapshotAccessibilityTree(this, &response); |
| 2152 Send(new AccessibilityHostMsg_SnapshotResponse( | 2154 Send(new AccessibilityHostMsg_SnapshotResponse( |
| 2153 routing_id_, callback_id, response)); | 2155 routing_id_, callback_id, response)); |
| 2154 } | 2156 } |
| 2155 | 2157 |
| 2156 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { | 2158 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 entry ? entry->root() : blink::WebHistoryItem(); | 2370 entry ? entry->root() : blink::WebHistoryItem(); |
| 2369 | 2371 |
| 2370 frame_->loadData(error_html, WebString::fromUTF8("text/html"), | 2372 frame_->loadData(error_html, WebString::fromUTF8("text/html"), |
| 2371 WebString::fromUTF8("UTF-8"), GURL(kUnreachableWebDataURL), | 2373 WebString::fromUTF8("UTF-8"), GURL(kUnreachableWebDataURL), |
| 2372 error.unreachableURL, replace, frame_load_type, history_item, | 2374 error.unreachableURL, replace, frame_load_type, history_item, |
| 2373 blink::WebHistoryDifferentDocumentLoad, false); | 2375 blink::WebHistoryDifferentDocumentLoad, false); |
| 2374 } | 2376 } |
| 2375 | 2377 |
| 2376 void RenderFrameImpl::DidMeaningfulLayout( | 2378 void RenderFrameImpl::DidMeaningfulLayout( |
| 2377 blink::WebMeaningfulLayout layout_type) { | 2379 blink::WebMeaningfulLayout layout_type) { |
| 2378 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 2380 for (auto& observer : observers_) |
| 2379 DidMeaningfulLayout(layout_type)); | 2381 observer.DidMeaningfulLayout(layout_type); |
| 2380 } | 2382 } |
| 2381 | 2383 |
| 2382 void RenderFrameImpl::DidCommitCompositorFrame() { | 2384 void RenderFrameImpl::DidCommitCompositorFrame() { |
| 2383 if (BrowserPluginManager::Get()) | 2385 if (BrowserPluginManager::Get()) |
| 2384 BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); | 2386 BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); |
| 2385 FOR_EACH_OBSERVER( | 2387 for (auto& observer : observers_) |
| 2386 RenderFrameObserver, observers_, DidCommitCompositorFrame()); | 2388 observer.DidCommitCompositorFrame(); |
| 2387 } | 2389 } |
| 2388 | 2390 |
| 2389 void RenderFrameImpl::DidCommitAndDrawCompositorFrame() { | 2391 void RenderFrameImpl::DidCommitAndDrawCompositorFrame() { |
| 2390 #if defined(ENABLE_PLUGINS) | 2392 #if defined(ENABLE_PLUGINS) |
| 2391 // Notify all instances that we painted. The same caveats apply as for | 2393 // Notify all instances that we painted. The same caveats apply as for |
| 2392 // ViewFlushedPaint regarding instances closing themselves, so we take | 2394 // ViewFlushedPaint regarding instances closing themselves, so we take |
| 2393 // similar precautions. | 2395 // similar precautions. |
| 2394 PepperPluginSet plugins = active_pepper_instances_; | 2396 PepperPluginSet plugins = active_pepper_instances_; |
| 2395 for (auto* plugin : plugins) { | 2397 for (auto* plugin : plugins) { |
| 2396 if (active_pepper_instances_.find(plugin) != active_pepper_instances_.end()) | 2398 if (active_pepper_instances_.find(plugin) != active_pepper_instances_.end()) |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2974 // NOTE: This function is called on the frame that is being detached and not | 2976 // NOTE: This function is called on the frame that is being detached and not |
| 2975 // the parent frame. This is different from createChildFrame() which is | 2977 // the parent frame. This is different from createChildFrame() which is |
| 2976 // called on the parent frame. | 2978 // called on the parent frame. |
| 2977 DCHECK_EQ(frame_, frame); | 2979 DCHECK_EQ(frame_, frame); |
| 2978 | 2980 |
| 2979 #if defined(ENABLE_PLUGINS) | 2981 #if defined(ENABLE_PLUGINS) |
| 2980 if (focused_pepper_plugin_) | 2982 if (focused_pepper_plugin_) |
| 2981 GetRenderWidget()->set_focused_pepper_plugin(nullptr); | 2983 GetRenderWidget()->set_focused_pepper_plugin(nullptr); |
| 2982 #endif | 2984 #endif |
| 2983 | 2985 |
| 2984 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameDetached()); | 2986 for (auto& observer : observers_) |
| 2985 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2987 observer.FrameDetached(); |
| 2986 FrameDetached(frame)); | 2988 for (auto& observer : render_view_->observers()) |
| 2989 observer.FrameDetached(frame); |
| 2987 | 2990 |
| 2988 // Send a state update before the frame is detached. | 2991 // Send a state update before the frame is detached. |
| 2989 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 2992 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2990 SendUpdateState(); | 2993 SendUpdateState(); |
| 2991 | 2994 |
| 2992 // We only notify the browser process when the frame is being detached for | 2995 // We only notify the browser process when the frame is being detached for |
| 2993 // removal and it was initiated from the renderer process. | 2996 // removal and it was initiated from the renderer process. |
| 2994 if (!in_browser_initiated_detach_ && type == DetachType::Remove) | 2997 if (!in_browser_initiated_detach_ && type == DetachType::Remove) |
| 2995 Send(new FrameHostMsg_Detach(routing_id_)); | 2998 Send(new FrameHostMsg_Detach(routing_id_)); |
| 2996 | 2999 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 // Object is invalid after this point. | 3031 // Object is invalid after this point. |
| 3029 } | 3032 } |
| 3030 | 3033 |
| 3031 void RenderFrameImpl::frameFocused() { | 3034 void RenderFrameImpl::frameFocused() { |
| 3032 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 3035 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
| 3033 } | 3036 } |
| 3034 | 3037 |
| 3035 void RenderFrameImpl::willCommitProvisionalLoad(blink::WebLocalFrame* frame) { | 3038 void RenderFrameImpl::willCommitProvisionalLoad(blink::WebLocalFrame* frame) { |
| 3036 DCHECK_EQ(frame_, frame); | 3039 DCHECK_EQ(frame_, frame); |
| 3037 | 3040 |
| 3038 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3041 for (auto& observer : observers_) |
| 3039 WillCommitProvisionalLoad()); | 3042 observer.WillCommitProvisionalLoad(); |
| 3040 } | 3043 } |
| 3041 | 3044 |
| 3042 void RenderFrameImpl::didChangeName(const blink::WebString& name, | 3045 void RenderFrameImpl::didChangeName(const blink::WebString& name, |
| 3043 const blink::WebString& unique_name) { | 3046 const blink::WebString& unique_name) { |
| 3044 // TODO(alexmos): According to https://crbug.com/169110, sending window.name | 3047 // TODO(alexmos): According to https://crbug.com/169110, sending window.name |
| 3045 // updates may have performance implications for benchmarks like SunSpider. | 3048 // updates may have performance implications for benchmarks like SunSpider. |
| 3046 // For now, send these updates only for --site-per-process, which needs to | 3049 // For now, send these updates only for --site-per-process, which needs to |
| 3047 // replicate frame names to frame proxies, and when | 3050 // replicate frame names to frame proxies, and when |
| 3048 // |report_frame_name_changes| is set (used by <webview>). If needed, this | 3051 // |report_frame_name_changes| is set (used by <webview>). If needed, this |
| 3049 // can be optimized further by only sending the update if there are any | 3052 // can be optimized further by only sending the update if there are any |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3098 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), | 3101 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), |
| 3099 FrameOwnerProperties(frame_owner_properties))); | 3102 FrameOwnerProperties(frame_owner_properties))); |
| 3100 } | 3103 } |
| 3101 | 3104 |
| 3102 void RenderFrameImpl::didMatchCSS( | 3105 void RenderFrameImpl::didMatchCSS( |
| 3103 blink::WebLocalFrame* frame, | 3106 blink::WebLocalFrame* frame, |
| 3104 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 3107 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 3105 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { | 3108 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { |
| 3106 DCHECK_EQ(frame_, frame); | 3109 DCHECK_EQ(frame_, frame); |
| 3107 | 3110 |
| 3108 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3111 for (auto& observer : observers_) |
| 3109 DidMatchCSS(newly_matching_selectors, | 3112 observer.DidMatchCSS(newly_matching_selectors, stopped_matching_selectors); |
| 3110 stopped_matching_selectors)); | |
| 3111 } | 3113 } |
| 3112 | 3114 |
| 3113 bool RenderFrameImpl::shouldReportDetailedMessageForSource( | 3115 bool RenderFrameImpl::shouldReportDetailedMessageForSource( |
| 3114 const blink::WebString& source) { | 3116 const blink::WebString& source) { |
| 3115 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource( | 3117 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource( |
| 3116 source); | 3118 source); |
| 3117 } | 3119 } |
| 3118 | 3120 |
| 3119 void RenderFrameImpl::didAddMessageToConsole( | 3121 void RenderFrameImpl::didAddMessageToConsole( |
| 3120 const blink::WebConsoleMessage& message, | 3122 const blink::WebConsoleMessage& message, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3134 log_severity = logging::LOG_WARNING; | 3136 log_severity = logging::LOG_WARNING; |
| 3135 break; | 3137 break; |
| 3136 case blink::WebConsoleMessage::LevelError: | 3138 case blink::WebConsoleMessage::LevelError: |
| 3137 log_severity = logging::LOG_ERROR; | 3139 log_severity = logging::LOG_ERROR; |
| 3138 break; | 3140 break; |
| 3139 default: | 3141 default: |
| 3140 log_severity = logging::LOG_VERBOSE; | 3142 log_severity = logging::LOG_VERBOSE; |
| 3141 } | 3143 } |
| 3142 | 3144 |
| 3143 if (shouldReportDetailedMessageForSource(source_name)) { | 3145 if (shouldReportDetailedMessageForSource(source_name)) { |
| 3144 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3146 for (auto& observer : observers_) { |
| 3145 DetailedConsoleMessageAdded( | 3147 observer.DetailedConsoleMessageAdded(message.text, source_name, |
| 3146 message.text, source_name, stack_trace, source_line, | 3148 stack_trace, source_line, |
| 3147 static_cast<uint32_t>(log_severity))); | 3149 static_cast<uint32_t>(log_severity)); |
| 3150 } |
| 3148 } | 3151 } |
| 3149 | 3152 |
| 3150 Send(new FrameHostMsg_AddMessageToConsole( | 3153 Send(new FrameHostMsg_AddMessageToConsole( |
| 3151 routing_id_, static_cast<int32_t>(log_severity), message.text, | 3154 routing_id_, static_cast<int32_t>(log_severity), message.text, |
| 3152 static_cast<int32_t>(source_line), source_name)); | 3155 static_cast<int32_t>(source_line), source_name)); |
| 3153 } | 3156 } |
| 3154 | 3157 |
| 3155 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, | 3158 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, |
| 3156 blink::WebNavigationPolicy policy, | 3159 blink::WebNavigationPolicy policy, |
| 3157 const blink::WebString& suggested_name, | 3160 const blink::WebString& suggested_name, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3171 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { | 3174 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { |
| 3172 // OOPIF enabled modes will punt this navigation to the browser in | 3175 // OOPIF enabled modes will punt this navigation to the browser in |
| 3173 // decidePolicyForNavigation. | 3176 // decidePolicyForNavigation. |
| 3174 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 3177 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 3175 return WebHistoryItem(); | 3178 return WebHistoryItem(); |
| 3176 | 3179 |
| 3177 return render_view_->history_controller()->GetItemForNewChildFrame(this); | 3180 return render_view_->history_controller()->GetItemForNewChildFrame(this); |
| 3178 } | 3181 } |
| 3179 | 3182 |
| 3180 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) { | 3183 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) { |
| 3181 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSendSubmitEvent(form)); | 3184 for (auto& observer : observers_) |
| 3185 observer.WillSendSubmitEvent(form); |
| 3182 } | 3186 } |
| 3183 | 3187 |
| 3184 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) { | 3188 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) { |
| 3185 // With PlzNavigate-enabled, this will be called before a DataSource has been | 3189 // With PlzNavigate-enabled, this will be called before a DataSource has been |
| 3186 // set-up. | 3190 // set-up. |
| 3187 // TODO(clamy): make sure the internal state is properly updated at some | 3191 // TODO(clamy): make sure the internal state is properly updated at some |
| 3188 // point in the navigation. | 3192 // point in the navigation. |
| 3189 if (!IsBrowserSideNavigationEnabled() && !!frame_->provisionalDataSource()) { | 3193 if (!IsBrowserSideNavigationEnabled() && !!frame_->provisionalDataSource()) { |
| 3190 DocumentState* document_state = | 3194 DocumentState* document_state = |
| 3191 DocumentState::FromDataSource(frame_->provisionalDataSource()); | 3195 DocumentState::FromDataSource(frame_->provisionalDataSource()); |
| 3192 NavigationStateImpl* navigation_state = | 3196 NavigationStateImpl* navigation_state = |
| 3193 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3197 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 3194 InternalDocumentStateData* internal_data = | 3198 InternalDocumentStateData* internal_data = |
| 3195 InternalDocumentStateData::FromDocumentState(document_state); | 3199 InternalDocumentStateData::FromDocumentState(document_state); |
| 3196 | 3200 |
| 3197 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), | 3201 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), |
| 3198 ui::PAGE_TRANSITION_LINK)) { | 3202 ui::PAGE_TRANSITION_LINK)) { |
| 3199 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT); | 3203 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT); |
| 3200 } | 3204 } |
| 3201 | 3205 |
| 3202 // Save these to be processed when the ensuing navigation is committed. | 3206 // Save these to be processed when the ensuing navigation is committed. |
| 3203 WebSearchableFormData web_searchable_form_data(form); | 3207 WebSearchableFormData web_searchable_form_data(form); |
| 3204 internal_data->set_searchable_form_url(web_searchable_form_data.url()); | 3208 internal_data->set_searchable_form_url(web_searchable_form_data.url()); |
| 3205 internal_data->set_searchable_form_encoding( | 3209 internal_data->set_searchable_form_encoding( |
| 3206 web_searchable_form_data.encoding().utf8()); | 3210 web_searchable_form_data.encoding().utf8()); |
| 3207 } | 3211 } |
| 3208 | 3212 |
| 3209 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSubmitForm(form)); | 3213 for (auto& observer : observers_) |
| 3214 observer.WillSubmitForm(form); |
| 3210 } | 3215 } |
| 3211 | 3216 |
| 3212 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame, | 3217 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame, |
| 3213 blink::WebDataSource* datasource) { | 3218 blink::WebDataSource* datasource) { |
| 3214 DCHECK(!frame_ || frame_ == frame); | 3219 DCHECK(!frame_ || frame_ == frame); |
| 3215 | 3220 |
| 3216 bool content_initiated = !pending_navigation_params_.get(); | 3221 bool content_initiated = !pending_navigation_params_.get(); |
| 3217 | 3222 |
| 3218 // Make sure any previous redirect URLs end up in our new data source. | 3223 // Make sure any previous redirect URLs end up in our new data source. |
| 3219 if (pending_navigation_params_.get()) { | 3224 if (pending_navigation_params_.get()) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3354 // Subframe navigations that don't add session history items must be | 3359 // Subframe navigations that don't add session history items must be |
| 3355 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 3360 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we |
| 3356 // handle loading of error pages. | 3361 // handle loading of error pages. |
| 3357 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 3362 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
| 3358 } | 3363 } |
| 3359 | 3364 |
| 3360 base::TimeTicks navigation_start = | 3365 base::TimeTicks navigation_start = |
| 3361 navigation_state->common_params().navigation_start; | 3366 navigation_state->common_params().navigation_start; |
| 3362 DCHECK(!navigation_start.is_null()); | 3367 DCHECK(!navigation_start.is_null()); |
| 3363 | 3368 |
| 3364 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3369 for (auto& observer : render_view_->observers()) |
| 3365 DidStartProvisionalLoad(frame)); | 3370 observer.DidStartProvisionalLoad(frame); |
| 3366 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 3371 for (auto& observer : observers_) |
| 3372 observer.DidStartProvisionalLoad(); |
| 3367 | 3373 |
| 3368 Send(new FrameHostMsg_DidStartProvisionalLoad( | 3374 Send(new FrameHostMsg_DidStartProvisionalLoad( |
| 3369 routing_id_, ds->request().url(), navigation_start)); | 3375 routing_id_, ds->request().url(), navigation_start)); |
| 3370 } | 3376 } |
| 3371 | 3377 |
| 3372 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 3378 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
| 3373 blink::WebLocalFrame* frame) { | 3379 blink::WebLocalFrame* frame) { |
| 3374 DCHECK_EQ(frame_, frame); | 3380 DCHECK_EQ(frame_, frame); |
| 3375 | 3381 |
| 3376 // We don't use HistoryController in OOPIF enabled modes. | 3382 // We don't use HistoryController in OOPIF enabled modes. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3391 DCHECK(ds); | 3397 DCHECK(ds); |
| 3392 | 3398 |
| 3393 const WebURLRequest& failed_request = ds->request(); | 3399 const WebURLRequest& failed_request = ds->request(); |
| 3394 | 3400 |
| 3395 // Notify the browser that we failed a provisional load with an error. | 3401 // Notify the browser that we failed a provisional load with an error. |
| 3396 // | 3402 // |
| 3397 // Note: It is important this notification occur before DidStopLoading so the | 3403 // Note: It is important this notification occur before DidStopLoading so the |
| 3398 // SSL manager can react to the provisional load failure before being | 3404 // SSL manager can react to the provisional load failure before being |
| 3399 // notified the load stopped. | 3405 // notified the load stopped. |
| 3400 // | 3406 // |
| 3401 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3407 for (auto& observer : render_view_->observers()) |
| 3402 DidFailProvisionalLoad(frame, error)); | 3408 observer.DidFailProvisionalLoad(frame, error); |
| 3403 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3409 for (auto& observer : observers_) |
| 3404 DidFailProvisionalLoad(error)); | 3410 observer.DidFailProvisionalLoad(error); |
| 3405 | 3411 |
| 3406 SendFailedProvisionalLoad(failed_request, error, frame); | 3412 SendFailedProvisionalLoad(failed_request, error, frame); |
| 3407 | 3413 |
| 3408 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) | 3414 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) |
| 3409 return; | 3415 return; |
| 3410 | 3416 |
| 3411 // Make sure we never show errors in view source mode. | 3417 // Make sure we never show errors in view source mode. |
| 3412 frame->enableViewSourceMode(false); | 3418 frame->enableViewSourceMode(false); |
| 3413 | 3419 |
| 3414 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3420 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3590 } | 3596 } |
| 3591 } else { | 3597 } else { |
| 3592 if (request_params.nav_entry_id != 0 && | 3598 if (request_params.nav_entry_id != 0 && |
| 3593 !request_params.intended_as_new_entry) { | 3599 !request_params.intended_as_new_entry) { |
| 3594 // This is a successful session history navigation! | 3600 // This is a successful session history navigation! |
| 3595 render_view_->history_list_offset_ = | 3601 render_view_->history_list_offset_ = |
| 3596 request_params.pending_history_list_offset; | 3602 request_params.pending_history_list_offset; |
| 3597 } | 3603 } |
| 3598 } | 3604 } |
| 3599 | 3605 |
| 3600 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, | 3606 for (auto& observer : render_view_->observers_) |
| 3601 DidCommitProvisionalLoad(frame, is_new_navigation)); | 3607 observer.DidCommitProvisionalLoad(frame, is_new_navigation); |
| 3602 FOR_EACH_OBSERVER( | 3608 for (auto& observer : observers_) { |
| 3603 RenderFrameObserver, observers_, | 3609 observer.DidCommitProvisionalLoad(is_new_navigation, |
| 3604 DidCommitProvisionalLoad(is_new_navigation, | 3610 navigation_state->WasWithinSamePage()); |
| 3605 navigation_state->WasWithinSamePage())); | 3611 } |
| 3606 | 3612 |
| 3607 if (!frame->parent()) { // Only for top frames. | 3613 if (!frame->parent()) { // Only for top frames. |
| 3608 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 3614 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 3609 if (render_thread_impl) { // Can be NULL in tests. | 3615 if (render_thread_impl) { // Can be NULL in tests. |
| 3610 render_thread_impl->histogram_customizer()-> | 3616 render_thread_impl->histogram_customizer()-> |
| 3611 RenderViewNavigatedToHost(GURL(GetLoadingUrl()).host(), | 3617 RenderViewNavigatedToHost(GURL(GetLoadingUrl()).host(), |
| 3612 RenderView::GetRenderViewCount()); | 3618 RenderView::GetRenderViewCount()); |
| 3613 // The scheduler isn't interested in history inert commits unless they | 3619 // The scheduler isn't interested in history inert commits unless they |
| 3614 // are reloads. | 3620 // are reloads. |
| 3615 if (commit_type != blink::WebHistoryInertCommit || | 3621 if (commit_type != blink::WebHistoryInertCommit || |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3630 | 3636 |
| 3631 SendDidCommitProvisionalLoad(frame, commit_type, item); | 3637 SendDidCommitProvisionalLoad(frame, commit_type, item); |
| 3632 | 3638 |
| 3633 // Check whether we have new encoding name. | 3639 // Check whether we have new encoding name. |
| 3634 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3640 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 3635 } | 3641 } |
| 3636 | 3642 |
| 3637 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { | 3643 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { |
| 3638 DCHECK(!frame_ || frame_ == frame); | 3644 DCHECK(!frame_ || frame_ == frame); |
| 3639 | 3645 |
| 3640 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidCreateNewDocument()); | 3646 for (auto& observer : observers_) |
| 3641 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3647 observer.DidCreateNewDocument(); |
| 3642 DidCreateNewDocument(frame)); | 3648 for (auto& observer : render_view_->observers()) |
| 3649 observer.DidCreateNewDocument(frame); |
| 3643 } | 3650 } |
| 3644 | 3651 |
| 3645 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) { | 3652 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) { |
| 3646 DCHECK_EQ(frame_, frame); | 3653 DCHECK_EQ(frame_, frame); |
| 3647 | 3654 |
| 3648 int enabled_bindings = render_view_->GetEnabledBindings(); | 3655 int enabled_bindings = render_view_->GetEnabledBindings(); |
| 3649 | 3656 |
| 3650 if (enabled_bindings & BINDINGS_POLICY_WEB_UI) | 3657 if (enabled_bindings & BINDINGS_POLICY_WEB_UI) |
| 3651 WebUIExtension::Install(frame); | 3658 WebUIExtension::Install(frame); |
| 3652 | 3659 |
| 3653 if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION) | 3660 if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION) |
| 3654 DomAutomationController::Install(this, frame); | 3661 DomAutomationController::Install(this, frame); |
| 3655 | 3662 |
| 3656 if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION) | 3663 if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION) |
| 3657 StatsCollectionController::Install(frame); | 3664 StatsCollectionController::Install(frame); |
| 3658 | 3665 |
| 3659 const base::CommandLine& command_line = | 3666 const base::CommandLine& command_line = |
| 3660 *base::CommandLine::ForCurrentProcess(); | 3667 *base::CommandLine::ForCurrentProcess(); |
| 3661 | 3668 |
| 3662 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) | 3669 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) |
| 3663 GpuBenchmarking::Install(frame); | 3670 GpuBenchmarking::Install(frame); |
| 3664 | 3671 |
| 3665 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) | 3672 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) |
| 3666 SkiaBenchmarking::Install(frame); | 3673 SkiaBenchmarking::Install(frame); |
| 3667 | 3674 |
| 3668 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3675 for (auto& observer : render_view_->observers()) |
| 3669 DidClearWindowObject(frame)); | 3676 observer.DidClearWindowObject(frame); |
| 3670 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); | 3677 for (auto& observer : observers_) |
| 3678 observer.DidClearWindowObject(); |
| 3671 } | 3679 } |
| 3672 | 3680 |
| 3673 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { | 3681 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { |
| 3674 DCHECK(!frame_ || frame_ == frame); | 3682 DCHECK(!frame_ || frame_ == frame); |
| 3675 | 3683 |
| 3676 // Notify the browser about non-blank documents loading in the top frame. | 3684 // Notify the browser about non-blank documents loading in the top frame. |
| 3677 GURL url = frame->document().url(); | 3685 GURL url = frame->document().url(); |
| 3678 if (url.is_valid() && url.spec() != url::kAboutBlankURL) { | 3686 if (url.is_valid() && url.spec() != url::kAboutBlankURL) { |
| 3679 // TODO(nasko): Check if webview()->mainFrame() is the same as the | 3687 // TODO(nasko): Check if webview()->mainFrame() is the same as the |
| 3680 // frame->tree()->top(). | 3688 // frame->tree()->top(). |
| 3681 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); | 3689 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); |
| 3682 if (frame == main_frame) { | 3690 if (frame == main_frame) { |
| 3683 // For now, don't remember plugin zoom values. We don't want to mix them | 3691 // For now, don't remember plugin zoom values. We don't want to mix them |
| 3684 // with normal web content (i.e. a fixed layout plugin would usually want | 3692 // with normal web content (i.e. a fixed layout plugin would usually want |
| 3685 // them different). | 3693 // them different). |
| 3686 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( | 3694 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( |
| 3687 render_view_->GetRoutingID(), | 3695 render_view_->GetRoutingID(), |
| 3688 main_frame->document().isPluginDocument())); | 3696 main_frame->document().isPluginDocument())); |
| 3689 } | 3697 } |
| 3690 } | 3698 } |
| 3691 | 3699 |
| 3692 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3700 for (auto& observer : observers_) |
| 3693 DidCreateDocumentElement()); | 3701 observer.DidCreateDocumentElement(); |
| 3694 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3702 for (auto& observer : render_view_->observers()) |
| 3695 DidCreateDocumentElement(frame)); | 3703 observer.DidCreateDocumentElement(frame); |
| 3696 } | 3704 } |
| 3697 | 3705 |
| 3698 void RenderFrameImpl::runScriptsAtDocumentElementAvailable( | 3706 void RenderFrameImpl::runScriptsAtDocumentElementAvailable( |
| 3699 blink::WebLocalFrame* frame) { | 3707 blink::WebLocalFrame* frame) { |
| 3700 DCHECK(!frame_ || frame_ == frame); | 3708 DCHECK(!frame_ || frame_ == frame); |
| 3701 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); | 3709 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); |
| 3702 | 3710 |
| 3703 MojoBindingsController* mojo_bindings_controller = | 3711 MojoBindingsController* mojo_bindings_controller = |
| 3704 MojoBindingsController::Get(this); | 3712 MojoBindingsController::Get(this); |
| 3705 if (mojo_bindings_controller) | 3713 if (mojo_bindings_controller) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3741 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { | 3749 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { |
| 3742 TRACE_EVENT1("navigation,benchmark,rail", | 3750 TRACE_EVENT1("navigation,benchmark,rail", |
| 3743 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); | 3751 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); |
| 3744 DCHECK_EQ(frame_, frame); | 3752 DCHECK_EQ(frame_, frame); |
| 3745 WebDataSource* ds = frame->dataSource(); | 3753 WebDataSource* ds = frame->dataSource(); |
| 3746 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3754 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3747 document_state->set_finish_document_load_time(Time::Now()); | 3755 document_state->set_finish_document_load_time(Time::Now()); |
| 3748 | 3756 |
| 3749 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); | 3757 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); |
| 3750 | 3758 |
| 3751 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3759 for (auto& observer : render_view_->observers()) |
| 3752 DidFinishDocumentLoad(frame)); | 3760 observer.DidFinishDocumentLoad(frame); |
| 3753 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); | 3761 for (auto& observer : observers_) |
| 3762 observer.DidFinishDocumentLoad(); |
| 3754 | 3763 |
| 3755 // Check whether we have new encoding name. | 3764 // Check whether we have new encoding name. |
| 3756 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3765 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 3757 } | 3766 } |
| 3758 | 3767 |
| 3759 void RenderFrameImpl::runScriptsAtDocumentReady(blink::WebLocalFrame* frame, | 3768 void RenderFrameImpl::runScriptsAtDocumentReady(blink::WebLocalFrame* frame, |
| 3760 bool document_is_empty) { | 3769 bool document_is_empty) { |
| 3761 DCHECK_EQ(frame_, frame); | 3770 DCHECK_EQ(frame_, frame); |
| 3762 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); | 3771 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); |
| 3763 | 3772 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3827 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, | 3836 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, |
| 3828 const blink::WebURLError& error, | 3837 const blink::WebURLError& error, |
| 3829 blink::WebHistoryCommitType commit_type) { | 3838 blink::WebHistoryCommitType commit_type) { |
| 3830 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didFailLoad", | 3839 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didFailLoad", |
| 3831 "id", routing_id_); | 3840 "id", routing_id_); |
| 3832 DCHECK_EQ(frame_, frame); | 3841 DCHECK_EQ(frame_, frame); |
| 3833 // TODO(nasko): Move implementation here. No state needed. | 3842 // TODO(nasko): Move implementation here. No state needed. |
| 3834 WebDataSource* ds = frame->dataSource(); | 3843 WebDataSource* ds = frame->dataSource(); |
| 3835 DCHECK(ds); | 3844 DCHECK(ds); |
| 3836 | 3845 |
| 3837 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3846 for (auto& observer : render_view_->observers()) |
| 3838 DidFailLoad(frame, error)); | 3847 observer.DidFailLoad(frame, error); |
| 3839 | 3848 |
| 3840 const WebURLRequest& failed_request = ds->request(); | 3849 const WebURLRequest& failed_request = ds->request(); |
| 3841 base::string16 error_description; | 3850 base::string16 error_description; |
| 3842 GetContentClient()->renderer()->GetNavigationErrorStrings( | 3851 GetContentClient()->renderer()->GetNavigationErrorStrings( |
| 3843 this, | 3852 this, |
| 3844 failed_request, | 3853 failed_request, |
| 3845 error, | 3854 error, |
| 3846 nullptr, | 3855 nullptr, |
| 3847 &error_description); | 3856 &error_description); |
| 3848 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, | 3857 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3859 WebDataSource* ds = frame->dataSource(); | 3868 WebDataSource* ds = frame->dataSource(); |
| 3860 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3869 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3861 if (document_state->finish_load_time().is_null()) { | 3870 if (document_state->finish_load_time().is_null()) { |
| 3862 if (!frame->parent()) { | 3871 if (!frame->parent()) { |
| 3863 TRACE_EVENT_INSTANT0("WebCore,benchmark,rail", "LoadFinished", | 3872 TRACE_EVENT_INSTANT0("WebCore,benchmark,rail", "LoadFinished", |
| 3864 TRACE_EVENT_SCOPE_PROCESS); | 3873 TRACE_EVENT_SCOPE_PROCESS); |
| 3865 } | 3874 } |
| 3866 document_state->set_finish_load_time(Time::Now()); | 3875 document_state->set_finish_load_time(Time::Now()); |
| 3867 } | 3876 } |
| 3868 | 3877 |
| 3869 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3878 for (auto& observer : render_view_->observers()) |
| 3870 DidFinishLoad(frame)); | 3879 observer.DidFinishLoad(frame); |
| 3871 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); | 3880 for (auto& observer : observers_) |
| 3881 observer.DidFinishLoad(); |
| 3872 | 3882 |
| 3873 Send(new FrameHostMsg_DidFinishLoad(routing_id_, | 3883 Send(new FrameHostMsg_DidFinishLoad(routing_id_, |
| 3874 ds->request().url())); | 3884 ds->request().url())); |
| 3875 } | 3885 } |
| 3876 | 3886 |
| 3877 void RenderFrameImpl::didNavigateWithinPage( | 3887 void RenderFrameImpl::didNavigateWithinPage( |
| 3878 blink::WebLocalFrame* frame, | 3888 blink::WebLocalFrame* frame, |
| 3879 const blink::WebHistoryItem& item, | 3889 const blink::WebHistoryItem& item, |
| 3880 blink::WebHistoryCommitType commit_type, | 3890 blink::WebHistoryCommitType commit_type, |
| 3881 bool content_initiated) { | 3891 bool content_initiated) { |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4348 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( | 4358 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( |
| 4349 routing_id_, url)); | 4359 routing_id_, url)); |
| 4350 } | 4360 } |
| 4351 | 4361 |
| 4352 void RenderFrameImpl::didRunContentWithCertificateErrors( | 4362 void RenderFrameImpl::didRunContentWithCertificateErrors( |
| 4353 const blink::WebURL& url) { | 4363 const blink::WebURL& url) { |
| 4354 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); | 4364 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); |
| 4355 } | 4365 } |
| 4356 | 4366 |
| 4357 void RenderFrameImpl::didChangePerformanceTiming() { | 4367 void RenderFrameImpl::didChangePerformanceTiming() { |
| 4358 FOR_EACH_OBSERVER(RenderFrameObserver, | 4368 for (auto& observer : observers_) |
| 4359 observers_, | 4369 observer.DidChangePerformanceTiming(); |
| 4360 DidChangePerformanceTiming()); | |
| 4361 } | 4370 } |
| 4362 | 4371 |
| 4363 void RenderFrameImpl::didObserveLoadingBehavior( | 4372 void RenderFrameImpl::didObserveLoadingBehavior( |
| 4364 blink::WebLoadingBehaviorFlag behavior) { | 4373 blink::WebLoadingBehaviorFlag behavior) { |
| 4365 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 4374 for (auto& observer : observers_) |
| 4366 DidObserveLoadingBehavior(behavior)); | 4375 observer.DidObserveLoadingBehavior(behavior); |
| 4367 } | 4376 } |
| 4368 | 4377 |
| 4369 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, | 4378 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, |
| 4370 v8::Local<v8::Context> context, | 4379 v8::Local<v8::Context> context, |
| 4371 int extension_group, | 4380 int extension_group, |
| 4372 int world_id) { | 4381 int world_id) { |
| 4373 DCHECK_EQ(frame_, frame); | 4382 DCHECK_EQ(frame_, frame); |
| 4374 | 4383 |
| 4375 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 4384 for (auto& observer : observers_) |
| 4376 DidCreateScriptContext(context, extension_group, world_id)); | 4385 observer.DidCreateScriptContext(context, extension_group, world_id); |
| 4377 } | 4386 } |
| 4378 | 4387 |
| 4379 void RenderFrameImpl::willReleaseScriptContext(blink::WebLocalFrame* frame, | 4388 void RenderFrameImpl::willReleaseScriptContext(blink::WebLocalFrame* frame, |
| 4380 v8::Local<v8::Context> context, | 4389 v8::Local<v8::Context> context, |
| 4381 int world_id) { | 4390 int world_id) { |
| 4382 DCHECK_EQ(frame_, frame); | 4391 DCHECK_EQ(frame_, frame); |
| 4383 | 4392 |
| 4384 FOR_EACH_OBSERVER(RenderFrameObserver, | 4393 for (auto& observer : observers_) |
| 4385 observers_, | 4394 observer.WillReleaseScriptContext(context, world_id); |
| 4386 WillReleaseScriptContext(context, world_id)); | |
| 4387 } | 4395 } |
| 4388 | 4396 |
| 4389 void RenderFrameImpl::didChangeScrollOffset(blink::WebLocalFrame* frame) { | 4397 void RenderFrameImpl::didChangeScrollOffset(blink::WebLocalFrame* frame) { |
| 4390 DCHECK_EQ(frame_, frame); | 4398 DCHECK_EQ(frame_, frame); |
| 4391 render_view_->StartNavStateSyncTimerIfNecessary(this); | 4399 render_view_->StartNavStateSyncTimerIfNecessary(this); |
| 4392 | 4400 |
| 4393 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeScrollOffset()); | 4401 for (auto& observer : observers_) |
| 4402 observer.DidChangeScrollOffset(); |
| 4394 } | 4403 } |
| 4395 | 4404 |
| 4396 void RenderFrameImpl::willInsertBody(blink::WebLocalFrame* frame) { | 4405 void RenderFrameImpl::willInsertBody(blink::WebLocalFrame* frame) { |
| 4397 DCHECK(!frame_ || frame_ == frame); | 4406 DCHECK(!frame_ || frame_ == frame); |
| 4398 if (!frame->parent()) { | 4407 if (!frame->parent()) { |
| 4399 render_view_->Send(new ViewHostMsg_WillInsertBody( | 4408 render_view_->Send(new ViewHostMsg_WillInsertBody( |
| 4400 render_view_->GetRoutingID())); | 4409 render_view_->GetRoutingID())); |
| 4401 } | 4410 } |
| 4402 } | 4411 } |
| 4403 | 4412 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4558 const blink::WebAXObject& end_object, | 4567 const blink::WebAXObject& end_object, |
| 4559 int end_offset) { | 4568 int end_offset) { |
| 4560 if (render_accessibility_) { | 4569 if (render_accessibility_) { |
| 4561 render_accessibility_->HandleAccessibilityFindInPageResult( | 4570 render_accessibility_->HandleAccessibilityFindInPageResult( |
| 4562 identifier, match_index, start_object, start_offset, | 4571 identifier, match_index, start_object, start_offset, |
| 4563 end_object, end_offset); | 4572 end_object, end_offset); |
| 4564 } | 4573 } |
| 4565 } | 4574 } |
| 4566 | 4575 |
| 4567 void RenderFrameImpl::didChangeManifest() { | 4576 void RenderFrameImpl::didChangeManifest() { |
| 4568 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeManifest()); | 4577 for (auto& observer : observers_) |
| 4578 observer.DidChangeManifest(); |
| 4569 } | 4579 } |
| 4570 | 4580 |
| 4571 void RenderFrameImpl::enterFullscreen() { | 4581 void RenderFrameImpl::enterFullscreen() { |
| 4572 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, true)); | 4582 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, true)); |
| 4573 } | 4583 } |
| 4574 | 4584 |
| 4575 void RenderFrameImpl::exitFullscreen() { | 4585 void RenderFrameImpl::exitFullscreen() { |
| 4576 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, false)); | 4586 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, false)); |
| 4577 } | 4587 } |
| 4578 | 4588 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4633 void RenderFrameImpl::OnStop() { | 4643 void RenderFrameImpl::OnStop() { |
| 4634 DCHECK(frame_); | 4644 DCHECK(frame_); |
| 4635 | 4645 |
| 4636 // The stopLoading call may run script, which may cause this frame to be | 4646 // The stopLoading call may run script, which may cause this frame to be |
| 4637 // detached/deleted. If that happens, return immediately. | 4647 // detached/deleted. If that happens, return immediately. |
| 4638 base::WeakPtr<RenderFrameImpl> weak_this = weak_factory_.GetWeakPtr(); | 4648 base::WeakPtr<RenderFrameImpl> weak_this = weak_factory_.GetWeakPtr(); |
| 4639 frame_->stopLoading(); | 4649 frame_->stopLoading(); |
| 4640 if (!weak_this) | 4650 if (!weak_this) |
| 4641 return; | 4651 return; |
| 4642 | 4652 |
| 4643 if (frame_ && !frame_->parent()) | 4653 if (frame_ && !frame_->parent()) { |
| 4644 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, OnStop()); | 4654 for (auto& observer : render_view_->observers_) |
| 4655 observer.OnStop(); |
| 4656 } |
| 4645 | 4657 |
| 4646 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); | 4658 for (auto& observer : observers_) |
| 4659 observer.OnStop(); |
| 4647 } | 4660 } |
| 4648 | 4661 |
| 4649 void RenderFrameImpl::WasHidden() { | 4662 void RenderFrameImpl::WasHidden() { |
| 4650 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasHidden()); | 4663 for (auto& observer : observers_) |
| 4664 observer.WasHidden(); |
| 4651 | 4665 |
| 4652 #if defined(ENABLE_PLUGINS) | 4666 #if defined(ENABLE_PLUGINS) |
| 4653 for (auto* plugin : active_pepper_instances_) | 4667 for (auto* plugin : active_pepper_instances_) |
| 4654 plugin->PageVisibilityChanged(false); | 4668 plugin->PageVisibilityChanged(false); |
| 4655 #endif // ENABLE_PLUGINS | 4669 #endif // ENABLE_PLUGINS |
| 4656 | 4670 |
| 4657 if (GetWebFrame()->frameWidget()) { | 4671 if (GetWebFrame()->frameWidget()) { |
| 4658 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); | 4672 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); |
| 4659 } | 4673 } |
| 4660 } | 4674 } |
| 4661 | 4675 |
| 4662 void RenderFrameImpl::WasShown() { | 4676 void RenderFrameImpl::WasShown() { |
| 4663 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); | 4677 for (auto& observer : observers_) |
| 4678 observer.WasShown(); |
| 4664 | 4679 |
| 4665 #if defined(ENABLE_PLUGINS) | 4680 #if defined(ENABLE_PLUGINS) |
| 4666 for (auto* plugin : active_pepper_instances_) | 4681 for (auto* plugin : active_pepper_instances_) |
| 4667 plugin->PageVisibilityChanged(true); | 4682 plugin->PageVisibilityChanged(true); |
| 4668 #endif // ENABLE_PLUGINS | 4683 #endif // ENABLE_PLUGINS |
| 4669 | 4684 |
| 4670 if (GetWebFrame()->frameWidget()) { | 4685 if (GetWebFrame()->frameWidget()) { |
| 4671 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); | 4686 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); |
| 4672 } | 4687 } |
| 4673 } | 4688 } |
| 4674 | 4689 |
| 4675 void RenderFrameImpl::WidgetWillClose() { | 4690 void RenderFrameImpl::WidgetWillClose() { |
| 4676 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WidgetWillClose()); | 4691 for (auto& observer : observers_) |
| 4692 observer.WidgetWillClose(); |
| 4677 } | 4693 } |
| 4678 | 4694 |
| 4679 bool RenderFrameImpl::IsMainFrame() { | 4695 bool RenderFrameImpl::IsMainFrame() { |
| 4680 return is_main_frame_; | 4696 return is_main_frame_; |
| 4681 } | 4697 } |
| 4682 | 4698 |
| 4683 bool RenderFrameImpl::IsHidden() { | 4699 bool RenderFrameImpl::IsHidden() { |
| 4684 return GetRenderWidget()->is_hidden(); | 4700 return GetRenderWidget()->is_hidden(); |
| 4685 } | 4701 } |
| 4686 | 4702 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4955 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4971 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 4956 } | 4972 } |
| 4957 | 4973 |
| 4958 void RenderFrameImpl::HandleWebAccessibilityEvent( | 4974 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 4959 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 4975 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 4960 if (render_accessibility_) | 4976 if (render_accessibility_) |
| 4961 render_accessibility_->HandleWebAccessibilityEvent(obj, event); | 4977 render_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 4962 } | 4978 } |
| 4963 | 4979 |
| 4964 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 4980 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 4965 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FocusedNodeChanged(node)); | 4981 for (auto& observer : observers_) |
| 4982 observer.FocusedNodeChanged(node); |
| 4966 } | 4983 } |
| 4967 | 4984 |
| 4968 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 4985 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 4969 if (render_accessibility()) | 4986 if (render_accessibility()) |
| 4970 render_accessibility()->AccessibilityFocusedNodeChanged(node); | 4987 render_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 4971 } | 4988 } |
| 4972 | 4989 |
| 4973 // PlzNavigate | 4990 // PlzNavigate |
| 4974 void RenderFrameImpl::OnCommitNavigation( | 4991 void RenderFrameImpl::OnCommitNavigation( |
| 4975 const ResourceResponseHead& response, | 4992 const ResourceResponseHead& response, |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5986 } | 6003 } |
| 5987 | 6004 |
| 5988 void RenderFrameImpl::PrepareRenderViewForNavigation( | 6005 void RenderFrameImpl::PrepareRenderViewForNavigation( |
| 5989 const GURL& url, | 6006 const GURL& url, |
| 5990 const RequestNavigationParams& request_params) { | 6007 const RequestNavigationParams& request_params) { |
| 5991 DCHECK(render_view_->webview()); | 6008 DCHECK(render_view_->webview()); |
| 5992 | 6009 |
| 5993 MaybeHandleDebugURL(url); | 6010 MaybeHandleDebugURL(url); |
| 5994 | 6011 |
| 5995 if (is_main_frame_) { | 6012 if (is_main_frame_) { |
| 5996 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, | 6013 for (auto& observer : render_view_->observers_) |
| 5997 Navigate(url)); | 6014 observer.Navigate(url); |
| 5998 } | 6015 } |
| 5999 | 6016 |
| 6000 render_view_->history_list_offset_ = | 6017 render_view_->history_list_offset_ = |
| 6001 request_params.current_history_list_offset; | 6018 request_params.current_history_list_offset; |
| 6002 render_view_->history_list_length_ = | 6019 render_view_->history_list_length_ = |
| 6003 request_params.current_history_list_length; | 6020 request_params.current_history_list_length; |
| 6004 if (request_params.should_clear_history_list) { | 6021 if (request_params.should_clear_history_list) { |
| 6005 CHECK_EQ(-1, render_view_->history_list_offset_); | 6022 CHECK_EQ(-1, render_view_->history_list_offset_); |
| 6006 CHECK_EQ(0, render_view_->history_list_length_); | 6023 CHECK_EQ(0, render_view_->history_list_length_); |
| 6007 } | 6024 } |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6548 // event target. Potentially a Pepper plugin will receive the event. | 6565 // event target. Potentially a Pepper plugin will receive the event. |
| 6549 // In order to tell whether a plugin gets the last mouse event and which it | 6566 // In order to tell whether a plugin gets the last mouse event and which it |
| 6550 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6567 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6551 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6568 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6552 // |pepper_last_mouse_event_target_|. | 6569 // |pepper_last_mouse_event_target_|. |
| 6553 pepper_last_mouse_event_target_ = nullptr; | 6570 pepper_last_mouse_event_target_ = nullptr; |
| 6554 #endif | 6571 #endif |
| 6555 } | 6572 } |
| 6556 | 6573 |
| 6557 } // namespace content | 6574 } // namespace content |
| OLD | NEW |