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

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

Issue 1688253003: Ensure WebLocalFrame parameters match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no commentary Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 #else 2553 #else
2554 return nullptr; 2554 return nullptr;
2555 #endif // defined(OS_ANDROID) 2555 #endif // defined(OS_ANDROID)
2556 } 2556 }
2557 2557
2558 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost( 2558 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost(
2559 blink::WebLocalFrame* frame, 2559 blink::WebLocalFrame* frame,
2560 blink::WebApplicationCacheHostClient* client) { 2560 blink::WebApplicationCacheHostClient* client) {
2561 if (!frame || !frame->view()) 2561 if (!frame || !frame->view())
2562 return NULL; 2562 return NULL;
2563 DCHECK(!frame_ || frame_ == frame); 2563 DCHECK_EQ(frame_, frame);
2564 return new RendererWebApplicationCacheHostImpl( 2564 return new RendererWebApplicationCacheHostImpl(
2565 RenderViewImpl::FromWebView(frame->view()), client, 2565 RenderViewImpl::FromWebView(frame->view()), client,
2566 RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy()); 2566 RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy());
2567 } 2567 }
2568 2568
2569 blink::WebWorkerContentSettingsClientProxy* 2569 blink::WebWorkerContentSettingsClientProxy*
2570 RenderFrameImpl::createWorkerContentSettingsClientProxy( 2570 RenderFrameImpl::createWorkerContentSettingsClientProxy(
2571 blink::WebLocalFrame* frame) { 2571 blink::WebLocalFrame* frame) {
2572 if (!frame || !frame->view()) 2572 if (!frame || !frame->view())
2573 return NULL; 2573 return NULL;
2574 DCHECK(!frame_ || frame_ == frame); 2574 DCHECK_EQ(frame_, frame);
2575 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy( 2575 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy(
2576 this, frame); 2576 this, frame);
2577 } 2577 }
2578 2578
2579 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu( 2579 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu(
2580 const WebPopupMenuInfo& popup_menu_info, 2580 const WebPopupMenuInfo& popup_menu_info,
2581 WebExternalPopupMenuClient* popup_menu_client) { 2581 WebExternalPopupMenuClient* popup_menu_client) {
2582 #if defined(OS_MACOSX) || defined(OS_ANDROID) 2582 #if defined(OS_MACOSX) || defined(OS_ANDROID)
2583 // An IPC message is sent to the browser to build and display the actual 2583 // An IPC message is sent to the browser to build and display the actual
2584 // popup. The user could have time to click a different select by the time 2584 // popup. The user could have time to click a different select by the time
(...skipping 10 matching lines...) Expand all
2595 external_popup_menu_.get(), 2595 external_popup_menu_.get(),
2596 render_view_->screen_metrics_emulator_.get()); 2596 render_view_->screen_metrics_emulator_.get());
2597 } 2597 }
2598 return external_popup_menu_.get(); 2598 return external_popup_menu_.get();
2599 #else 2599 #else
2600 return NULL; 2600 return NULL;
2601 #endif 2601 #endif
2602 } 2602 }
2603 2603
2604 blink::WebCookieJar* RenderFrameImpl::cookieJar(blink::WebLocalFrame* frame) { 2604 blink::WebCookieJar* RenderFrameImpl::cookieJar(blink::WebLocalFrame* frame) {
2605 DCHECK(!frame_ || frame_ == frame); 2605 DCHECK_EQ(frame_, frame);
2606 return &cookie_jar_; 2606 return &cookie_jar_;
2607 } 2607 }
2608 2608
2609 blink::WebServiceWorkerProvider* RenderFrameImpl::createServiceWorkerProvider( 2609 blink::WebServiceWorkerProvider* RenderFrameImpl::createServiceWorkerProvider(
2610 blink::WebLocalFrame* frame) { 2610 blink::WebLocalFrame* frame) {
2611 DCHECK(!frame_ || frame_ == frame); 2611 DCHECK_EQ(frame_, frame);
2612 // At this point we should have non-null data source. 2612 // At this point we should have non-null data source.
2613 DCHECK(frame->dataSource()); 2613 DCHECK(frame->dataSource());
2614 if (!ChildThreadImpl::current()) 2614 if (!ChildThreadImpl::current())
2615 return nullptr; // May be null in some tests. 2615 return nullptr; // May be null in some tests.
2616 ServiceWorkerNetworkProvider* provider = 2616 ServiceWorkerNetworkProvider* provider =
2617 ServiceWorkerNetworkProvider::FromDocumentState( 2617 ServiceWorkerNetworkProvider::FromDocumentState(
2618 DocumentState::FromDataSource(frame->dataSource())); 2618 DocumentState::FromDataSource(frame->dataSource()));
2619 DCHECK(provider); 2619 DCHECK(provider);
2620 if (!provider->context()) { 2620 if (!provider->context()) {
2621 // The context can be null when the frame is sandboxed. 2621 // The context can be null when the frame is sandboxed.
2622 return nullptr; 2622 return nullptr;
2623 } 2623 }
2624 return new WebServiceWorkerProviderImpl( 2624 return new WebServiceWorkerProviderImpl(
2625 ChildThreadImpl::current()->thread_safe_sender(), 2625 ChildThreadImpl::current()->thread_safe_sender(),
2626 provider->context()); 2626 provider->context());
2627 } 2627 }
2628 2628
2629 void RenderFrameImpl::didAccessInitialDocument(blink::WebLocalFrame* frame) { 2629 void RenderFrameImpl::didAccessInitialDocument(blink::WebLocalFrame* frame) {
2630 DCHECK(!frame_ || frame_ == frame); 2630 DCHECK_EQ(frame_, frame);
2631 // If the request hasn't yet committed, notify the browser process that it is 2631 // If the request hasn't yet committed, notify the browser process that it is
2632 // no longer safe to show the pending URL of the main frame, since a URL spoof 2632 // no longer safe to show the pending URL of the main frame, since a URL spoof
2633 // is now possible. (If the request has committed, the browser already knows.) 2633 // is now possible. (If the request has committed, the browser already knows.)
2634 if (!frame->parent()) { 2634 if (!frame->parent()) {
2635 DocumentState* document_state = 2635 DocumentState* document_state =
2636 DocumentState::FromDataSource(frame->dataSource()); 2636 DocumentState::FromDataSource(frame->dataSource());
2637 NavigationStateImpl* navigation_state = 2637 NavigationStateImpl* navigation_state =
2638 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 2638 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2639 2639
2640 if (!navigation_state->request_committed()) { 2640 if (!navigation_state->request_committed()) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() : 2699 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() :
2700 MSG_ROUTING_NONE; 2700 MSG_ROUTING_NONE;
2701 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); 2701 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id));
2702 } 2702 }
2703 2703
2704 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) { 2704 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) {
2705 // NOTE: This function is called on the frame that is being detached and not 2705 // NOTE: This function is called on the frame that is being detached and not
2706 // the parent frame. This is different from createChildFrame() which is 2706 // the parent frame. This is different from createChildFrame() which is
2707 // called on the parent frame. 2707 // called on the parent frame.
2708 CHECK(!is_detaching_); 2708 CHECK(!is_detaching_);
2709 DCHECK(!frame_ || frame_ == frame); 2709 DCHECK_EQ(frame_, frame);
2710 2710
2711 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameDetached()); 2711 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameDetached());
2712 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2712 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2713 FrameDetached(frame)); 2713 FrameDetached(frame));
2714 2714
2715 // We only notify the browser process when the frame is being detached for 2715 // We only notify the browser process when the frame is being detached for
2716 // removal and it was initiated from the renderer process. 2716 // removal and it was initiated from the renderer process.
2717 if (!in_browser_initiated_detach_ && type == DetachType::Remove) 2717 if (!in_browser_initiated_detach_ && type == DetachType::Remove)
2718 Send(new FrameHostMsg_Detach(routing_id_)); 2718 Send(new FrameHostMsg_Detach(routing_id_));
2719 2719
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 2753
2754 delete this; 2754 delete this;
2755 // Object is invalid after this point. 2755 // Object is invalid after this point.
2756 } 2756 }
2757 2757
2758 void RenderFrameImpl::frameFocused() { 2758 void RenderFrameImpl::frameFocused() {
2759 Send(new FrameHostMsg_FrameFocused(routing_id_)); 2759 Send(new FrameHostMsg_FrameFocused(routing_id_));
2760 } 2760 }
2761 2761
2762 void RenderFrameImpl::willClose(blink::WebFrame* frame) { 2762 void RenderFrameImpl::willClose(blink::WebFrame* frame) {
2763 DCHECK(!frame_ || frame_ == frame); 2763 DCHECK_EQ(frame_, frame);
2764 2764
2765 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose()); 2765 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose());
2766 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2766 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2767 FrameWillClose(frame)); 2767 FrameWillClose(frame));
2768 } 2768 }
2769 2769
2770 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame, 2770 void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame,
2771 const blink::WebString& name) { 2771 const blink::WebString& name) {
2772 DCHECK(!frame_ || frame_ == frame); 2772 DCHECK_EQ(frame_, frame);
2773 2773
2774 // TODO(alexmos): According to https://crbug.com/169110, sending window.name 2774 // TODO(alexmos): According to https://crbug.com/169110, sending window.name
2775 // updates may have performance implications for benchmarks like SunSpider. 2775 // updates may have performance implications for benchmarks like SunSpider.
2776 // For now, send these updates only for --site-per-process, which needs to 2776 // For now, send these updates only for --site-per-process, which needs to
2777 // replicate frame names to frame proxies, and when 2777 // replicate frame names to frame proxies, and when
2778 // |report_frame_name_changes| is set (used by <webview>). If needed, this 2778 // |report_frame_name_changes| is set (used by <webview>). If needed, this
2779 // can be optimized further by only sending the update if there are any 2779 // can be optimized further by only sending the update if there are any
2780 // remote frames in the frame tree, or delaying and batching up IPCs if 2780 // remote frames in the frame tree, or delaying and batching up IPCs if
2781 // updates are happening too frequently. 2781 // updates are happening too frequently.
2782 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || 2782 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() ||
(...skipping 18 matching lines...) Expand all
2801 const blink::WebFrameOwnerProperties& frame_owner_properties) { 2801 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2802 Send(new FrameHostMsg_DidChangeFrameOwnerProperties( 2802 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
2803 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), 2803 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
2804 frame_owner_properties)); 2804 frame_owner_properties));
2805 } 2805 }
2806 2806
2807 void RenderFrameImpl::didMatchCSS( 2807 void RenderFrameImpl::didMatchCSS(
2808 blink::WebLocalFrame* frame, 2808 blink::WebLocalFrame* frame,
2809 const blink::WebVector<blink::WebString>& newly_matching_selectors, 2809 const blink::WebVector<blink::WebString>& newly_matching_selectors,
2810 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 2810 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
2811 DCHECK(!frame_ || frame_ == frame); 2811 DCHECK_EQ(frame_, frame);
2812 2812
2813 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 2813 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
2814 DidMatchCSS(newly_matching_selectors, 2814 DidMatchCSS(newly_matching_selectors,
2815 stopped_matching_selectors)); 2815 stopped_matching_selectors));
2816 } 2816 }
2817 2817
2818 bool RenderFrameImpl::shouldReportDetailedMessageForSource( 2818 bool RenderFrameImpl::shouldReportDetailedMessageForSource(
2819 const blink::WebString& source) { 2819 const blink::WebString& source) {
2820 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource( 2820 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource(
2821 source); 2821 source);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2877 // OOPIF enabled modes will punt this navigation to the browser in 2877 // OOPIF enabled modes will punt this navigation to the browser in
2878 // decidePolicyForNavigation. 2878 // decidePolicyForNavigation.
2879 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 2879 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
2880 return WebHistoryItem(); 2880 return WebHistoryItem();
2881 2881
2882 return render_view_->history_controller()->GetItemForNewChildFrame(this); 2882 return render_view_->history_controller()->GetItemForNewChildFrame(this);
2883 } 2883 }
2884 2884
2885 void RenderFrameImpl::willSendSubmitEvent(blink::WebLocalFrame* frame, 2885 void RenderFrameImpl::willSendSubmitEvent(blink::WebLocalFrame* frame,
2886 const blink::WebFormElement& form) { 2886 const blink::WebFormElement& form) {
2887 DCHECK(!frame_ || frame_ == frame); 2887 DCHECK_EQ(frame_, frame);
2888 2888
2889 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSendSubmitEvent(form)); 2889 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSendSubmitEvent(form));
2890 } 2890 }
2891 2891
2892 void RenderFrameImpl::willSubmitForm(blink::WebLocalFrame* frame, 2892 void RenderFrameImpl::willSubmitForm(blink::WebLocalFrame* frame,
2893 const blink::WebFormElement& form) { 2893 const blink::WebFormElement& form) {
2894 DCHECK(!frame_ || frame_ == frame); 2894 DCHECK_EQ(frame_, frame);
2895 DocumentState* document_state = 2895 DocumentState* document_state =
2896 DocumentState::FromDataSource(frame->provisionalDataSource()); 2896 DocumentState::FromDataSource(frame->provisionalDataSource());
2897 NavigationStateImpl* navigation_state = 2897 NavigationStateImpl* navigation_state =
2898 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 2898 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2899 InternalDocumentStateData* internal_data = 2899 InternalDocumentStateData* internal_data =
2900 InternalDocumentStateData::FromDocumentState(document_state); 2900 InternalDocumentStateData::FromDocumentState(document_state);
2901 2901
2902 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), 2902 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(),
2903 ui::PAGE_TRANSITION_LINK)) { 2903 ui::PAGE_TRANSITION_LINK)) {
2904 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT); 2904 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 3024
3025 ServiceWorkerNetworkProvider::AttachToDocumentState( 3025 ServiceWorkerNetworkProvider::AttachToDocumentState(
3026 DocumentState::FromDataSource(datasource), 3026 DocumentState::FromDataSource(datasource),
3027 ServiceWorkerNetworkProvider::CreateForNavigation( 3027 ServiceWorkerNetworkProvider::CreateForNavigation(
3028 routing_id_, navigation_state->request_params(), 3028 routing_id_, navigation_state->request_params(),
3029 frame->effectiveSandboxFlags(), content_initiated)); 3029 frame->effectiveSandboxFlags(), content_initiated));
3030 } 3030 }
3031 3031
3032 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, 3032 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame,
3033 double triggering_event_time) { 3033 double triggering_event_time) {
3034 DCHECK(!frame_ || frame_ == frame); 3034 DCHECK_EQ(frame_, frame);
3035 WebDataSource* ds = frame->provisionalDataSource(); 3035 WebDataSource* ds = frame->provisionalDataSource();
3036 3036
3037 // In fast/loader/stop-provisional-loads.html, we abort the load before this 3037 // In fast/loader/stop-provisional-loads.html, we abort the load before this
3038 // callback is invoked. 3038 // callback is invoked.
3039 if (!ds) 3039 if (!ds)
3040 return; 3040 return;
3041 3041
3042 TRACE_EVENT2("navigation,benchmark", 3042 TRACE_EVENT2("navigation,benchmark",
3043 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 3043 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
3044 "url", ds->request().url().string().utf8()); 3044 "url", ds->request().url().string().utf8());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3078 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3079 DidStartProvisionalLoad(frame)); 3079 DidStartProvisionalLoad(frame));
3080 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); 3080 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
3081 3081
3082 Send(new FrameHostMsg_DidStartProvisionalLoad( 3082 Send(new FrameHostMsg_DidStartProvisionalLoad(
3083 routing_id_, ds->request().url(), navigation_start)); 3083 routing_id_, ds->request().url(), navigation_start));
3084 } 3084 }
3085 3085
3086 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 3086 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
3087 blink::WebLocalFrame* frame) { 3087 blink::WebLocalFrame* frame) {
3088 DCHECK(!frame_ || frame_ == frame); 3088 DCHECK_EQ(frame_, frame);
3089 3089
3090 // We don't use HistoryController in OOPIF enabled modes. 3090 // We don't use HistoryController in OOPIF enabled modes.
3091 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 3091 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
3092 return; 3092 return;
3093 3093
3094 render_view_->history_controller()->RemoveChildrenForRedirect(this); 3094 render_view_->history_controller()->RemoveChildrenForRedirect(this);
3095 } 3095 }
3096 3096
3097 void RenderFrameImpl::didFailProvisionalLoad( 3097 void RenderFrameImpl::didFailProvisionalLoad(
3098 blink::WebLocalFrame* frame, 3098 blink::WebLocalFrame* frame,
3099 const blink::WebURLError& error, 3099 const blink::WebURLError& error,
3100 blink::WebHistoryCommitType commit_type) { 3100 blink::WebHistoryCommitType commit_type) {
3101 TRACE_EVENT1("navigation,benchmark", 3101 TRACE_EVENT1("navigation,benchmark",
3102 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); 3102 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_);
3103 DCHECK(!frame_ || frame_ == frame); 3103 DCHECK_EQ(frame_, frame);
3104 WebDataSource* ds = frame->provisionalDataSource(); 3104 WebDataSource* ds = frame->provisionalDataSource();
3105 DCHECK(ds); 3105 DCHECK(ds);
3106 3106
3107 const WebURLRequest& failed_request = ds->request(); 3107 const WebURLRequest& failed_request = ds->request();
3108 3108
3109 // Notify the browser that we failed a provisional load with an error. 3109 // Notify the browser that we failed a provisional load with an error.
3110 // 3110 //
3111 // Note: It is important this notification occur before DidStopLoading so the 3111 // Note: It is important this notification occur before DidStopLoading so the
3112 // SSL manager can react to the provisional load failure before being 3112 // SSL manager can react to the provisional load failure before being
3113 // notified the load stopped. 3113 // notified the load stopped.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3149 LoadNavigationErrorPage(failed_request, error, replace); 3149 LoadNavigationErrorPage(failed_request, error, replace);
3150 } 3150 }
3151 3151
3152 void RenderFrameImpl::didCommitProvisionalLoad( 3152 void RenderFrameImpl::didCommitProvisionalLoad(
3153 blink::WebLocalFrame* frame, 3153 blink::WebLocalFrame* frame,
3154 const blink::WebHistoryItem& item, 3154 const blink::WebHistoryItem& item,
3155 blink::WebHistoryCommitType commit_type) { 3155 blink::WebHistoryCommitType commit_type) {
3156 TRACE_EVENT2("navigation", "RenderFrameImpl::didCommitProvisionalLoad", 3156 TRACE_EVENT2("navigation", "RenderFrameImpl::didCommitProvisionalLoad",
3157 "id", routing_id_, 3157 "id", routing_id_,
3158 "url", GetLoadingUrl().possibly_invalid_spec()); 3158 "url", GetLoadingUrl().possibly_invalid_spec());
3159 DCHECK(!frame_ || frame_ == frame); 3159 DCHECK_EQ(frame_, frame);
3160 DocumentState* document_state = 3160 DocumentState* document_state =
3161 DocumentState::FromDataSource(frame->dataSource()); 3161 DocumentState::FromDataSource(frame->dataSource());
3162 NavigationStateImpl* navigation_state = 3162 NavigationStateImpl* navigation_state =
3163 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3163 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3164 WebURLResponseExtraDataImpl* extra_data = 3164 WebURLResponseExtraDataImpl* extra_data =
3165 GetExtraDataFromResponse(frame->dataSource()->response()); 3165 GetExtraDataFromResponse(frame->dataSource()->response());
3166 // Only update LoFi state for new main frame documents. Subframes inherit from 3166 // Only update LoFi state for new main frame documents. Subframes inherit from
3167 // the main frame and should not change at commit time. 3167 // the main frame and should not change at commit time.
3168 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { 3168 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) {
3169 is_using_lofi_ = extra_data && extra_data->is_using_lofi(); 3169 is_using_lofi_ = extra_data && extra_data->is_using_lofi();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 3321
3322 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { 3322 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) {
3323 DCHECK(!frame_ || frame_ == frame); 3323 DCHECK(!frame_ || frame_ == frame);
3324 3324
3325 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidCreateNewDocument()); 3325 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidCreateNewDocument());
3326 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3326 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3327 DidCreateNewDocument(frame)); 3327 DidCreateNewDocument(frame));
3328 } 3328 }
3329 3329
3330 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) { 3330 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) {
3331 DCHECK(!frame_ || frame_ == frame); 3331 DCHECK_EQ(frame_, frame);
3332 3332
3333 int enabled_bindings = render_view_->GetEnabledBindings(); 3333 int enabled_bindings = render_view_->GetEnabledBindings();
3334 3334
3335 if (enabled_bindings & BINDINGS_POLICY_WEB_UI) 3335 if (enabled_bindings & BINDINGS_POLICY_WEB_UI)
3336 WebUIExtension::Install(frame); 3336 WebUIExtension::Install(frame);
3337 3337
3338 if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION) 3338 if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION)
3339 DomAutomationController::Install(this, frame); 3339 DomAutomationController::Install(this, frame);
3340 3340
3341 if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION) 3341 if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 3376
3377 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 3377 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
3378 DidCreateDocumentElement()); 3378 DidCreateDocumentElement());
3379 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3379 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3380 DidCreateDocumentElement(frame)); 3380 DidCreateDocumentElement(frame));
3381 } 3381 }
3382 3382
3383 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, 3383 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame,
3384 const blink::WebString& title, 3384 const blink::WebString& title,
3385 blink::WebTextDirection direction) { 3385 blink::WebTextDirection direction) {
3386 DCHECK(!frame_ || frame_ == frame); 3386 DCHECK_EQ(frame_, frame);
3387 // Ignore all but top level navigations. 3387 // Ignore all but top level navigations.
3388 if (!frame->parent()) { 3388 if (!frame->parent()) {
3389 base::string16 title16 = title; 3389 base::string16 title16 = title;
3390 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( 3390 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel(
3391 routing_id_, base::UTF16ToUTF8(title16)); 3391 routing_id_, base::UTF16ToUTF8(title16));
3392 3392
3393 base::string16 shortened_title = title16.substr(0, kMaxTitleChars); 3393 base::string16 shortened_title = title16.substr(0, kMaxTitleChars);
3394 Send(new FrameHostMsg_UpdateTitle(routing_id_, 3394 Send(new FrameHostMsg_UpdateTitle(routing_id_,
3395 shortened_title, direction)); 3395 shortened_title, direction));
3396 } 3396 }
3397 3397
3398 // Also check whether we have new encoding name. 3398 // Also check whether we have new encoding name.
3399 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 3399 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
3400 } 3400 }
3401 3401
3402 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, 3402 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame,
3403 blink::WebIconURL::Type icon_type) { 3403 blink::WebIconURL::Type icon_type) {
3404 DCHECK(!frame_ || frame_ == frame); 3404 DCHECK_EQ(frame_, frame);
3405 // TODO(nasko): Investigate wheather implementation should move here. 3405 // TODO(nasko): Investigate wheather implementation should move here.
3406 render_view_->didChangeIcon(frame, icon_type); 3406 render_view_->didChangeIcon(frame, icon_type);
3407 } 3407 }
3408 3408
3409 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame, 3409 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame,
3410 bool document_is_empty) { 3410 bool document_is_empty) {
3411 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishDocumentLoad", 3411 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishDocumentLoad",
3412 "id", routing_id_); 3412 "id", routing_id_);
3413 DCHECK(!frame_ || frame_ == frame); 3413 DCHECK_EQ(frame_, frame);
3414 WebDataSource* ds = frame->dataSource(); 3414 WebDataSource* ds = frame->dataSource();
3415 DocumentState* document_state = DocumentState::FromDataSource(ds); 3415 DocumentState* document_state = DocumentState::FromDataSource(ds);
3416 document_state->set_finish_document_load_time(Time::Now()); 3416 document_state->set_finish_document_load_time(Time::Now());
3417 3417
3418 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); 3418 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_));
3419 3419
3420 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3420 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3421 DidFinishDocumentLoad(frame)); 3421 DidFinishDocumentLoad(frame));
3422 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); 3422 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad());
3423 3423
(...skipping 25 matching lines...) Expand all
3449 &error_domain)) { 3449 &error_domain)) {
3450 WebURLError error; 3450 WebURLError error;
3451 error.unreachableURL = frame->document().url(); 3451 error.unreachableURL = frame->document().url();
3452 error.domain = WebString::fromUTF8(error_domain); 3452 error.domain = WebString::fromUTF8(error_domain);
3453 error.reason = http_status_code; 3453 error.reason = http_status_code;
3454 LoadNavigationErrorPage(frame->dataSource()->request(), error, true); 3454 LoadNavigationErrorPage(frame->dataSource()->request(), error, true);
3455 } 3455 }
3456 } 3456 }
3457 3457
3458 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { 3458 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) {
3459 DCHECK(!frame_ || frame_ == frame); 3459 DCHECK_EQ(frame_, frame);
3460 if (!frame->parent()) { 3460 if (!frame->parent()) {
3461 FrameMsg_UILoadMetricsReportType::Value report_type = 3461 FrameMsg_UILoadMetricsReportType::Value report_type =
3462 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 3462 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
3463 frame->dataSource()->request().inputPerfMetricReportPolicy()); 3463 frame->dataSource()->request().inputPerfMetricReportPolicy());
3464 base::TimeTicks ui_timestamp = base::TimeTicks() + 3464 base::TimeTicks ui_timestamp = base::TimeTicks() +
3465 base::TimeDelta::FromSecondsD( 3465 base::TimeDelta::FromSecondsD(
3466 frame->dataSource()->request().uiStartTime()); 3466 frame->dataSource()->request().uiStartTime());
3467 3467
3468 Send(new FrameHostMsg_DocumentOnLoadCompleted( 3468 Send(new FrameHostMsg_DocumentOnLoadCompleted(
3469 routing_id_, report_type, ui_timestamp)); 3469 routing_id_, report_type, ui_timestamp));
3470 } 3470 }
3471 } 3471 }
3472 3472
3473 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, 3473 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame,
3474 const blink::WebURLError& error, 3474 const blink::WebURLError& error,
3475 blink::WebHistoryCommitType commit_type) { 3475 blink::WebHistoryCommitType commit_type) {
3476 TRACE_EVENT1("navigation", "RenderFrameImpl::didFailLoad", 3476 TRACE_EVENT1("navigation", "RenderFrameImpl::didFailLoad",
3477 "id", routing_id_); 3477 "id", routing_id_);
3478 DCHECK(!frame_ || frame_ == frame); 3478 DCHECK_EQ(frame_, frame);
3479 // TODO(nasko): Move implementation here. No state needed. 3479 // TODO(nasko): Move implementation here. No state needed.
3480 WebDataSource* ds = frame->dataSource(); 3480 WebDataSource* ds = frame->dataSource();
3481 DCHECK(ds); 3481 DCHECK(ds);
3482 3482
3483 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3483 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3484 DidFailLoad(frame, error)); 3484 DidFailLoad(frame, error));
3485 3485
3486 const WebURLRequest& failed_request = ds->request(); 3486 const WebURLRequest& failed_request = ds->request();
3487 base::string16 error_description; 3487 base::string16 error_description;
3488 GetContentClient()->renderer()->GetNavigationErrorStrings( 3488 GetContentClient()->renderer()->GetNavigationErrorStrings(
3489 this, 3489 this,
3490 failed_request, 3490 failed_request,
3491 error, 3491 error,
3492 nullptr, 3492 nullptr,
3493 &error_description); 3493 &error_description);
3494 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, 3494 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_,
3495 failed_request.url(), 3495 failed_request.url(),
3496 error.reason, 3496 error.reason,
3497 error_description, 3497 error_description,
3498 error.wasIgnoredByHandler)); 3498 error.wasIgnoredByHandler));
3499 } 3499 }
3500 3500
3501 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) { 3501 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) {
3502 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishLoad", "id", 3502 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishLoad", "id",
3503 routing_id_); 3503 routing_id_);
3504 DCHECK(!frame_ || frame_ == frame); 3504 DCHECK_EQ(frame_, frame);
3505 WebDataSource* ds = frame->dataSource(); 3505 WebDataSource* ds = frame->dataSource();
3506 DocumentState* document_state = DocumentState::FromDataSource(ds); 3506 DocumentState* document_state = DocumentState::FromDataSource(ds);
3507 if (document_state->finish_load_time().is_null()) { 3507 if (document_state->finish_load_time().is_null()) {
3508 if (!frame->parent()) { 3508 if (!frame->parent()) {
3509 TRACE_EVENT_INSTANT0("WebCore,benchmark", "LoadFinished", 3509 TRACE_EVENT_INSTANT0("WebCore,benchmark", "LoadFinished",
3510 TRACE_EVENT_SCOPE_PROCESS); 3510 TRACE_EVENT_SCOPE_PROCESS);
3511 } 3511 }
3512 document_state->set_finish_load_time(Time::Now()); 3512 document_state->set_finish_load_time(Time::Now());
3513 } 3513 }
3514 3514
3515 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3515 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3516 DidFinishLoad(frame)); 3516 DidFinishLoad(frame));
3517 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); 3517 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad());
3518 3518
3519 // Don't send this message while the frame is swapped out. 3519 // Don't send this message while the frame is swapped out.
3520 if (is_swapped_out()) 3520 if (is_swapped_out())
3521 return; 3521 return;
3522 3522
3523 Send(new FrameHostMsg_DidFinishLoad(routing_id_, 3523 Send(new FrameHostMsg_DidFinishLoad(routing_id_,
3524 ds->request().url())); 3524 ds->request().url()));
3525 } 3525 }
3526 3526
3527 void RenderFrameImpl::didNavigateWithinPage(blink::WebLocalFrame* frame, 3527 void RenderFrameImpl::didNavigateWithinPage(blink::WebLocalFrame* frame,
3528 const blink::WebHistoryItem& item, 3528 const blink::WebHistoryItem& item,
3529 blink::WebHistoryCommitType commit_type) { 3529 blink::WebHistoryCommitType commit_type) {
3530 TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage", 3530 TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage",
3531 "id", routing_id_); 3531 "id", routing_id_);
3532 DCHECK(!frame_ || frame_ == frame); 3532 DCHECK_EQ(frame_, frame);
3533 // If this was a reference fragment navigation that we initiated, then we 3533 // If this was a reference fragment navigation that we initiated, then we
3534 // could end up having a non-null pending navigation params. We just need to 3534 // could end up having a non-null pending navigation params. We just need to
3535 // update the ExtraData on the datasource so that others who read the 3535 // update the ExtraData on the datasource so that others who read the
3536 // ExtraData will get the new NavigationState. Similarly, if we did not 3536 // ExtraData will get the new NavigationState. Similarly, if we did not
3537 // initiate this navigation, then we need to take care to reset any pre- 3537 // initiate this navigation, then we need to take care to reset any pre-
3538 // existing navigation state to a content-initiated navigation state. 3538 // existing navigation state to a content-initiated navigation state.
3539 // UpdateNavigationState conveniently takes care of this for us. 3539 // UpdateNavigationState conveniently takes care of this for us.
3540 DocumentState* document_state = 3540 DocumentState* document_state =
3541 DocumentState::FromDataSource(frame->dataSource()); 3541 DocumentState::FromDataSource(frame->dataSource());
3542 UpdateNavigationState(document_state); 3542 UpdateNavigationState(document_state);
3543 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 3543 static_cast<NavigationStateImpl*>(document_state->navigation_state())
3544 ->set_was_within_same_page(true); 3544 ->set_was_within_same_page(true);
3545 3545
3546 didCommitProvisionalLoad(frame, item, commit_type); 3546 didCommitProvisionalLoad(frame, item, commit_type);
3547 } 3547 }
3548 3548
3549 void RenderFrameImpl::didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) { 3549 void RenderFrameImpl::didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) {
3550 DCHECK(!frame_ || frame_ == frame); 3550 DCHECK_EQ(frame_, frame);
3551 render_view_->StartNavStateSyncTimerIfNecessary(this); 3551 render_view_->StartNavStateSyncTimerIfNecessary(this);
3552 } 3552 }
3553 3553
3554 void RenderFrameImpl::didChangeThemeColor() { 3554 void RenderFrameImpl::didChangeThemeColor() {
3555 if (frame_->parent()) 3555 if (frame_->parent())
3556 return; 3556 return;
3557 3557
3558 Send(new FrameHostMsg_DidChangeThemeColor( 3558 Send(new FrameHostMsg_DidChangeThemeColor(
3559 routing_id_, frame_->document().themeColor())); 3559 routing_id_, frame_->document().themeColor()));
3560 } 3560 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3698 3698
3699 void RenderFrameImpl::clearContextMenu() { 3699 void RenderFrameImpl::clearContextMenu() {
3700 context_menu_node_.reset(); 3700 context_menu_node_.reset();
3701 } 3701 }
3702 3702
3703 void RenderFrameImpl::willSendRequest( 3703 void RenderFrameImpl::willSendRequest(
3704 blink::WebLocalFrame* frame, 3704 blink::WebLocalFrame* frame,
3705 unsigned identifier, 3705 unsigned identifier,
3706 blink::WebURLRequest& request, 3706 blink::WebURLRequest& request,
3707 const blink::WebURLResponse& redirect_response) { 3707 const blink::WebURLResponse& redirect_response) {
3708 DCHECK(!frame_ || frame_ == frame); 3708 DCHECK_EQ(frame_, frame);
3709 // The request my be empty during tests. 3709 // The request my be empty during tests.
3710 if (request.url().isEmpty()) 3710 if (request.url().isEmpty())
3711 return; 3711 return;
3712 3712
3713 // Set the first party for cookies url if it has not been set yet (new 3713 // Set the first party for cookies url if it has not been set yet (new
3714 // requests). This value will be updated during redirects, consistent with 3714 // requests). This value will be updated during redirects, consistent with
3715 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 3715 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1
3716 if (request.firstPartyForCookies().isEmpty()) { 3716 if (request.firstPartyForCookies().isEmpty()) {
3717 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) { 3717 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) {
3718 request.setFirstPartyForCookies(request.url()); 3718 request.setFirstPartyForCookies(request.url());
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 } 3915 }
3916 3916
3917 if (!render_view_->renderer_preferences_.enable_referrers) 3917 if (!render_view_->renderer_preferences_.enable_referrers)
3918 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); 3918 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault);
3919 } 3919 }
3920 3920
3921 void RenderFrameImpl::didReceiveResponse( 3921 void RenderFrameImpl::didReceiveResponse(
3922 blink::WebLocalFrame* frame, 3922 blink::WebLocalFrame* frame,
3923 unsigned identifier, 3923 unsigned identifier,
3924 const blink::WebURLResponse& response) { 3924 const blink::WebURLResponse& response) {
3925 DCHECK(!frame_ || frame_ == frame); 3925 DCHECK_EQ(frame_, frame);
3926 // Only do this for responses that correspond to a provisional data source 3926 // Only do this for responses that correspond to a provisional data source
3927 // of the top-most frame. If we have a provisional data source, then we 3927 // of the top-most frame. If we have a provisional data source, then we
3928 // can't have any sub-resources yet, so we know that this response must 3928 // can't have any sub-resources yet, so we know that this response must
3929 // correspond to a frame load. 3929 // correspond to a frame load.
3930 if (!frame->provisionalDataSource() || frame->parent()) 3930 if (!frame->provisionalDataSource() || frame->parent())
3931 return; 3931 return;
3932 3932
3933 // If we are in view source mode, then just let the user see the source of 3933 // If we are in view source mode, then just let the user see the source of
3934 // the server's error page. 3934 // the server's error page.
3935 if (frame->isViewSourceModeEnabled()) 3935 if (frame->isViewSourceModeEnabled())
(...skipping 23 matching lines...) Expand all
3959 } 3959 }
3960 InternalDocumentStateData* internal_data = 3960 InternalDocumentStateData* internal_data =
3961 InternalDocumentStateData::FromDocumentState(document_state); 3961 InternalDocumentStateData::FromDocumentState(document_state);
3962 internal_data->set_http_status_code(http_status_code); 3962 internal_data->set_http_status_code(http_status_code);
3963 } 3963 }
3964 3964
3965 void RenderFrameImpl::didLoadResourceFromMemoryCache( 3965 void RenderFrameImpl::didLoadResourceFromMemoryCache(
3966 blink::WebLocalFrame* frame, 3966 blink::WebLocalFrame* frame,
3967 const blink::WebURLRequest& request, 3967 const blink::WebURLRequest& request,
3968 const blink::WebURLResponse& response) { 3968 const blink::WebURLResponse& response) {
3969 DCHECK(!frame_ || frame_ == frame); 3969 DCHECK_EQ(frame_, frame);
3970 // The recipients of this message have no use for data: URLs: they don't 3970 // The recipients of this message have no use for data: URLs: they don't
3971 // affect the page's insecure content list and are not in the disk cache. To 3971 // affect the page's insecure content list and are not in the disk cache. To
3972 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply 3972 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply
3973 // filter them out here. 3973 // filter them out here.
3974 GURL url(request.url()); 3974 GURL url(request.url());
3975 if (url.SchemeIs(url::kDataScheme)) 3975 if (url.SchemeIs(url::kDataScheme))
3976 return; 3976 return;
3977 3977
3978 // Let the browser know we loaded a resource from the memory cache. This 3978 // Let the browser know we loaded a resource from the memory cache. This
3979 // message is needed to display the correct SSL indicators. 3979 // message is needed to display the correct SSL indicators.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4025 void RenderFrameImpl::didChangePerformanceTiming() { 4025 void RenderFrameImpl::didChangePerformanceTiming() {
4026 FOR_EACH_OBSERVER(RenderFrameObserver, 4026 FOR_EACH_OBSERVER(RenderFrameObserver,
4027 observers_, 4027 observers_,
4028 DidChangePerformanceTiming()); 4028 DidChangePerformanceTiming());
4029 } 4029 }
4030 4030
4031 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, 4031 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame,
4032 v8::Local<v8::Context> context, 4032 v8::Local<v8::Context> context,
4033 int extension_group, 4033 int extension_group,
4034 int world_id) { 4034 int world_id) {
4035 DCHECK(!frame_ || frame_ == frame); 4035 DCHECK_EQ(frame_, frame);
4036 4036
4037 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 4037 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
4038 DidCreateScriptContext(context, extension_group, world_id)); 4038 DidCreateScriptContext(context, extension_group, world_id));
4039 } 4039 }
4040 4040
4041 void RenderFrameImpl::willReleaseScriptContext(blink::WebLocalFrame* frame, 4041 void RenderFrameImpl::willReleaseScriptContext(blink::WebLocalFrame* frame,
4042 v8::Local<v8::Context> context, 4042 v8::Local<v8::Context> context,
4043 int world_id) { 4043 int world_id) {
4044 DCHECK(!frame_ || frame_ == frame); 4044 DCHECK_EQ(frame_, frame);
4045 4045
4046 FOR_EACH_OBSERVER(RenderFrameObserver, 4046 FOR_EACH_OBSERVER(RenderFrameObserver,
4047 observers_, 4047 observers_,
4048 WillReleaseScriptContext(context, world_id)); 4048 WillReleaseScriptContext(context, world_id));
4049 } 4049 }
4050 4050
4051 void RenderFrameImpl::didChangeScrollOffset(blink::WebLocalFrame* frame) { 4051 void RenderFrameImpl::didChangeScrollOffset(blink::WebLocalFrame* frame) {
4052 DCHECK(!frame_ || frame_ == frame); 4052 DCHECK_EQ(frame_, frame);
4053 render_view_->StartNavStateSyncTimerIfNecessary(this); 4053 render_view_->StartNavStateSyncTimerIfNecessary(this);
4054 4054
4055 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeScrollOffset()); 4055 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeScrollOffset());
4056 } 4056 }
4057 4057
4058 void RenderFrameImpl::willInsertBody(blink::WebLocalFrame* frame) { 4058 void RenderFrameImpl::willInsertBody(blink::WebLocalFrame* frame) {
4059 DCHECK(!frame_ || frame_ == frame); 4059 DCHECK(!frame_ || frame_ == frame);
4060 if (!frame->parent()) { 4060 if (!frame->parent()) {
4061 render_view_->Send(new ViewHostMsg_WillInsertBody( 4061 render_view_->Send(new ViewHostMsg_WillInsertBody(
4062 render_view_->GetRoutingID())); 4062 render_view_->GetRoutingID()));
(...skipping 17 matching lines...) Expand all
4080 const blink::WebRect& selection_rect) { 4080 const blink::WebRect& selection_rect) {
4081 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, 4081 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect,
4082 active_match_ordinal, false)); 4082 active_match_ordinal, false));
4083 } 4083 }
4084 4084
4085 void RenderFrameImpl::requestStorageQuota( 4085 void RenderFrameImpl::requestStorageQuota(
4086 blink::WebLocalFrame* frame, 4086 blink::WebLocalFrame* frame,
4087 blink::WebStorageQuotaType type, 4087 blink::WebStorageQuotaType type,
4088 unsigned long long requested_size, 4088 unsigned long long requested_size,
4089 blink::WebStorageQuotaCallbacks callbacks) { 4089 blink::WebStorageQuotaCallbacks callbacks) {
4090 DCHECK(!frame_ || frame_ == frame); 4090 DCHECK_EQ(frame_, frame);
4091 WebSecurityOrigin origin = frame->document().securityOrigin(); 4091 WebSecurityOrigin origin = frame->document().securityOrigin();
4092 if (origin.isUnique()) { 4092 if (origin.isUnique()) {
4093 // Unique origins cannot store persistent state. 4093 // Unique origins cannot store persistent state.
4094 callbacks.didFail(blink::WebStorageQuotaErrorAbort); 4094 callbacks.didFail(blink::WebStorageQuotaErrorAbort);
4095 return; 4095 return;
4096 } 4096 }
4097 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( 4097 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota(
4098 render_view_->GetRoutingID(), 4098 render_view_->GetRoutingID(),
4099 blink::WebStringToGURL(origin.toString()), 4099 blink::WebStringToGURL(origin.toString()),
4100 static_cast<storage::StorageType>(type), 4100 static_cast<storage::StorageType>(type),
(...skipping 26 matching lines...) Expand all
4127 4127
4128 blink::WebPushClient* RenderFrameImpl::pushClient() { 4128 blink::WebPushClient* RenderFrameImpl::pushClient() {
4129 if (!push_messaging_dispatcher_) 4129 if (!push_messaging_dispatcher_)
4130 push_messaging_dispatcher_ = new PushMessagingDispatcher(this); 4130 push_messaging_dispatcher_ = new PushMessagingDispatcher(this);
4131 return push_messaging_dispatcher_; 4131 return push_messaging_dispatcher_;
4132 } 4132 }
4133 4133
4134 void RenderFrameImpl::willStartUsingPeerConnectionHandler( 4134 void RenderFrameImpl::willStartUsingPeerConnectionHandler(
4135 blink::WebLocalFrame* frame, 4135 blink::WebLocalFrame* frame,
4136 blink::WebRTCPeerConnectionHandler* handler) { 4136 blink::WebRTCPeerConnectionHandler* handler) {
4137 DCHECK(!frame_ || frame_ == frame); 4137 DCHECK_EQ(frame_, frame);
4138 #if defined(ENABLE_WEBRTC) 4138 #if defined(ENABLE_WEBRTC)
4139 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); 4139 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame);
4140 #endif 4140 #endif
4141 } 4141 }
4142 4142
4143 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() { 4143 blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() {
4144 if (!web_user_media_client_) 4144 if (!web_user_media_client_)
4145 InitializeUserMediaClient(); 4145 InitializeUserMediaClient();
4146 return web_user_media_client_; 4146 return web_user_media_client_;
4147 } 4147 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 if (!render_frame_proxy_) 4198 if (!render_frame_proxy_)
4199 return false; 4199 return false;
4200 4200
4201 render_frame_proxy_->postMessageEvent( 4201 render_frame_proxy_->postMessageEvent(
4202 source_frame, render_frame_proxy_->web_frame(), target_origin, event); 4202 source_frame, render_frame_proxy_->web_frame(), target_origin, event);
4203 return true; 4203 return true;
4204 } 4204 }
4205 4205
4206 blink::WebString RenderFrameImpl::userAgentOverride( 4206 blink::WebString RenderFrameImpl::userAgentOverride(
4207 blink::WebLocalFrame* frame) { 4207 blink::WebLocalFrame* frame) {
4208 DCHECK(!frame_ || frame_ == frame); 4208 DCHECK_EQ(frame_, frame);
4209 if (!render_view_->webview() || !render_view_->webview()->mainFrame() || 4209 if (!render_view_->webview() || !render_view_->webview()->mainFrame() ||
4210 render_view_->renderer_preferences_.user_agent_override.empty()) { 4210 render_view_->renderer_preferences_.user_agent_override.empty()) {
4211 return blink::WebString(); 4211 return blink::WebString();
4212 } 4212 }
4213 4213
4214 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource 4214 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource
4215 // associated with it, so the checks below are not valid. Temporarily 4215 // associated with it, so the checks below are not valid. Temporarily
4216 // return early and fix properly as part of https://crbug.com/426555. 4216 // return early and fix properly as part of https://crbug.com/426555.
4217 if (render_view_->webview()->mainFrame()->isWebRemoteFrame()) 4217 if (render_view_->webview()->mainFrame()->isWebRemoteFrame())
4218 return blink::WebString(); 4218 return blink::WebString();
4219 4219
4220 // If we're in the middle of committing a load, the data source we need 4220 // If we're in the middle of committing a load, the data source we need
4221 // will still be provisional. 4221 // will still be provisional.
4222 WebFrame* main_frame = render_view_->webview()->mainFrame(); 4222 WebFrame* main_frame = render_view_->webview()->mainFrame();
4223 WebDataSource* data_source = NULL; 4223 WebDataSource* data_source = NULL;
4224 if (main_frame->provisionalDataSource()) 4224 if (main_frame->provisionalDataSource())
4225 data_source = main_frame->provisionalDataSource(); 4225 data_source = main_frame->provisionalDataSource();
4226 else 4226 else
4227 data_source = main_frame->dataSource(); 4227 data_source = main_frame->dataSource();
4228 4228
4229 InternalDocumentStateData* internal_data = data_source ? 4229 InternalDocumentStateData* internal_data = data_source ?
4230 InternalDocumentStateData::FromDataSource(data_source) : NULL; 4230 InternalDocumentStateData::FromDataSource(data_source) : NULL;
4231 if (internal_data && internal_data->is_overriding_user_agent()) 4231 if (internal_data && internal_data->is_overriding_user_agent())
4232 return WebString::fromUTF8( 4232 return WebString::fromUTF8(
4233 render_view_->renderer_preferences_.user_agent_override); 4233 render_view_->renderer_preferences_.user_agent_override);
4234 return blink::WebString(); 4234 return blink::WebString();
4235 } 4235 }
4236 4236
4237 blink::WebString RenderFrameImpl::doNotTrackValue(blink::WebLocalFrame* frame) { 4237 blink::WebString RenderFrameImpl::doNotTrackValue(blink::WebLocalFrame* frame) {
4238 DCHECK(!frame_ || frame_ == frame); 4238 DCHECK_EQ(frame_, frame);
4239 if (render_view_->renderer_preferences_.enable_do_not_track) 4239 if (render_view_->renderer_preferences_.enable_do_not_track)
4240 return WebString::fromUTF8("1"); 4240 return WebString::fromUTF8("1");
4241 return WebString(); 4241 return WebString();
4242 } 4242 }
4243 4243
4244 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame, 4244 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame,
4245 bool default_value) { 4245 bool default_value) {
4246 DCHECK(!frame_ || frame_ == frame); 4246 DCHECK_EQ(frame_, frame);
4247 if (!default_value) 4247 if (!default_value)
4248 return false; 4248 return false;
4249 4249
4250 bool blocked = true; 4250 bool blocked = true;
4251 Send(new FrameHostMsg_Are3DAPIsBlocked( 4251 Send(new FrameHostMsg_Are3DAPIsBlocked(
4252 routing_id_, 4252 routing_id_,
4253 blink::WebStringToGURL(frame->top()->securityOrigin().toString()), 4253 blink::WebStringToGURL(frame->top()->securityOrigin().toString()),
4254 THREE_D_API_TYPE_WEBGL, 4254 THREE_D_API_TYPE_WEBGL,
4255 &blocked)); 4255 &blocked));
4256 return !blocked; 4256 return !blocked;
4257 } 4257 }
4258 4258
4259 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, 4259 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame,
4260 int arb_robustness_status_code) { 4260 int arb_robustness_status_code) {
4261 DCHECK(!frame_ || frame_ == frame); 4261 DCHECK_EQ(frame_, frame);
4262 Send(new FrameHostMsg_DidLose3DContext( 4262 Send(new FrameHostMsg_DidLose3DContext(
4263 blink::WebStringToGURL(frame->top()->securityOrigin().toString()), 4263 blink::WebStringToGURL(frame->top()->securityOrigin().toString()),
4264 THREE_D_API_TYPE_WEBGL, 4264 THREE_D_API_TYPE_WEBGL,
4265 arb_robustness_status_code)); 4265 arb_robustness_status_code));
4266 } 4266 }
4267 4267
4268 blink::WebScreenOrientationClient* 4268 blink::WebScreenOrientationClient*
4269 RenderFrameImpl::webScreenOrientationClient() { 4269 RenderFrameImpl::webScreenOrientationClient() {
4270 if (!screen_orientation_dispatcher_) 4270 if (!screen_orientation_dispatcher_)
4271 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); 4271 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this);
(...skipping 29 matching lines...) Expand all
4301 const blink::WebAXObject& end_object, 4301 const blink::WebAXObject& end_object,
4302 int end_offset) { 4302 int end_offset) {
4303 if (renderer_accessibility_) { 4303 if (renderer_accessibility_) {
4304 renderer_accessibility_->HandleAccessibilityFindInPageResult( 4304 renderer_accessibility_->HandleAccessibilityFindInPageResult(
4305 identifier, match_index, start_object, start_offset, 4305 identifier, match_index, start_object, start_offset,
4306 end_object, end_offset); 4306 end_object, end_offset);
4307 } 4307 }
4308 } 4308 }
4309 4309
4310 void RenderFrameImpl::didChangeManifest(blink::WebLocalFrame* frame) { 4310 void RenderFrameImpl::didChangeManifest(blink::WebLocalFrame* frame) {
4311 DCHECK(!frame_ || frame_ == frame); 4311 DCHECK_EQ(frame_, frame);
4312 4312
4313 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeManifest()); 4313 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeManifest());
4314 } 4314 }
4315 4315
4316 bool RenderFrameImpl::enterFullscreen() { 4316 bool RenderFrameImpl::enterFullscreen() {
4317 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, true)); 4317 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, true));
4318 return true; 4318 return true;
4319 } 4319 }
4320 4320
4321 bool RenderFrameImpl::exitFullscreen() { 4321 bool RenderFrameImpl::exitFullscreen() {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4450 DCHECK_EQ(is_local_root, 4450 DCHECK_EQ(is_local_root,
4451 !(frame_->parent() && frame_->parent()->isWebLocalFrame())); 4451 !(frame_->parent() && frame_->parent()->isWebLocalFrame()));
4452 return render_widget_ != nullptr; 4452 return render_widget_ != nullptr;
4453 } 4453 }
4454 4454
4455 // Tell the embedding application that the URL of the active page has changed. 4455 // Tell the embedding application that the URL of the active page has changed.
4456 void RenderFrameImpl::SendDidCommitProvisionalLoad( 4456 void RenderFrameImpl::SendDidCommitProvisionalLoad(
4457 blink::WebFrame* frame, 4457 blink::WebFrame* frame,
4458 blink::WebHistoryCommitType commit_type, 4458 blink::WebHistoryCommitType commit_type,
4459 const blink::WebHistoryItem& item) { 4459 const blink::WebHistoryItem& item) {
4460 DCHECK(!frame_ || frame_ == frame); 4460 DCHECK_EQ(frame_, frame);
4461 WebDataSource* ds = frame->dataSource(); 4461 WebDataSource* ds = frame->dataSource();
4462 DCHECK(ds); 4462 DCHECK(ds);
4463 4463
4464 const WebURLRequest& request = ds->request(); 4464 const WebURLRequest& request = ds->request();
4465 const WebURLResponse& response = ds->response(); 4465 const WebURLResponse& response = ds->response();
4466 4466
4467 DocumentState* document_state = DocumentState::FromDataSource(ds); 4467 DocumentState* document_state = DocumentState::FromDataSource(ds);
4468 NavigationStateImpl* navigation_state = 4468 NavigationStateImpl* navigation_state =
4469 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 4469 static_cast<NavigationStateImpl*>(document_state->navigation_state());
4470 InternalDocumentStateData* internal_data = 4470 InternalDocumentStateData* internal_data =
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
6124 int match_count, 6124 int match_count,
6125 int ordinal, 6125 int ordinal,
6126 const WebRect& selection_rect, 6126 const WebRect& selection_rect,
6127 bool final_status_update) { 6127 bool final_status_update) {
6128 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6128 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6129 selection_rect, ordinal, 6129 selection_rect, ordinal,
6130 final_status_update)); 6130 final_status_update));
6131 } 6131 }
6132 6132
6133 } // namespace content 6133 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698