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

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

Issue 2918403003: Move [Provisional]DataSource accessors/methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Created 3 years, 6 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 | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/test_runner.cc » ('j') | 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 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after
3318 document_state = new DocumentState; 3318 document_state = new DocumentState;
3319 datasource->SetExtraData(document_state); 3319 datasource->SetExtraData(document_state);
3320 if (!content_initiated) 3320 if (!content_initiated)
3321 PopulateDocumentStateFromPending(document_state); 3321 PopulateDocumentStateFromPending(document_state);
3322 } 3322 }
3323 3323
3324 // Carry over the user agent override flag, if it exists. 3324 // Carry over the user agent override flag, if it exists.
3325 blink::WebView* webview = render_view_->webview(); 3325 blink::WebView* webview = render_view_->webview();
3326 if (content_initiated && webview && webview->MainFrame() && 3326 if (content_initiated && webview && webview->MainFrame() &&
3327 webview->MainFrame()->IsWebLocalFrame() && 3327 webview->MainFrame()->IsWebLocalFrame() &&
3328 webview->MainFrame()->DataSource()) { 3328 webview->MainFrame()->ToWebLocalFrame()->DataSource()) {
dcheng 2017/06/06 18:49:53 I guess this doesn't work at all in OOPIF =/
Łukasz Anforowicz 2017/06/06 19:31:45 Hmmm... to be honest, I was just trying to preserv
3329 DocumentState* old_document_state = 3329 DocumentState* old_document_state = DocumentState::FromDataSource(
3330 DocumentState::FromDataSource(webview->MainFrame()->DataSource()); 3330 webview->MainFrame()->ToWebLocalFrame()->DataSource());
3331 if (old_document_state) { 3331 if (old_document_state) {
3332 InternalDocumentStateData* internal_data = 3332 InternalDocumentStateData* internal_data =
3333 InternalDocumentStateData::FromDocumentState(document_state); 3333 InternalDocumentStateData::FromDocumentState(document_state);
3334 InternalDocumentStateData* old_internal_data = 3334 InternalDocumentStateData* old_internal_data =
3335 InternalDocumentStateData::FromDocumentState(old_document_state); 3335 InternalDocumentStateData::FromDocumentState(old_document_state);
3336 internal_data->set_is_overriding_user_agent( 3336 internal_data->set_is_overriding_user_agent(
3337 old_internal_data->is_overriding_user_agent()); 3337 old_internal_data->is_overriding_user_agent());
3338 } 3338 }
3339 } 3339 }
3340 3340
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
4548 if (!render_view_->webview() || !render_view_->webview()->MainFrame() || 4548 if (!render_view_->webview() || !render_view_->webview()->MainFrame() ||
4549 render_view_->renderer_preferences_.user_agent_override.empty()) { 4549 render_view_->renderer_preferences_.user_agent_override.empty()) {
4550 return blink::WebString(); 4550 return blink::WebString();
4551 } 4551 }
4552 4552
4553 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource 4553 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource
4554 // associated with it, so the checks below are not valid. Temporarily 4554 // associated with it, so the checks below are not valid. Temporarily
4555 // return early and fix properly as part of https://crbug.com/426555. 4555 // return early and fix properly as part of https://crbug.com/426555.
4556 if (render_view_->webview()->MainFrame()->IsWebRemoteFrame()) 4556 if (render_view_->webview()->MainFrame()->IsWebRemoteFrame())
4557 return blink::WebString(); 4557 return blink::WebString();
4558 WebLocalFrame* main_frame =
4559 render_view_->webview()->MainFrame()->ToWebLocalFrame();
4558 4560
4559 // If we're in the middle of committing a load, the data source we need 4561 // If we're in the middle of committing a load, the data source we need
4560 // will still be provisional. 4562 // will still be provisional.
4561 WebFrame* main_frame = render_view_->webview()->MainFrame();
4562 WebDataSource* data_source = NULL; 4563 WebDataSource* data_source = NULL;
4563 if (main_frame->ProvisionalDataSource()) 4564 if (main_frame->ProvisionalDataSource())
4564 data_source = main_frame->ProvisionalDataSource(); 4565 data_source = main_frame->ProvisionalDataSource();
4565 else 4566 else
4566 data_source = main_frame->DataSource(); 4567 data_source = main_frame->DataSource();
4567 4568
4568 InternalDocumentStateData* internal_data = data_source ? 4569 InternalDocumentStateData* internal_data = data_source ?
4569 InternalDocumentStateData::FromDataSource(data_source) : NULL; 4570 InternalDocumentStateData::FromDataSource(data_source) : NULL;
4570 if (internal_data && internal_data->is_overriding_user_agent()) 4571 if (internal_data && internal_data->is_overriding_user_agent())
4571 return WebString::FromUTF8( 4572 return WebString::FromUTF8(
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4734 return is_local_root; 4735 return is_local_root;
4735 } 4736 }
4736 4737
4737 const RenderFrameImpl* RenderFrameImpl::GetLocalRoot() const { 4738 const RenderFrameImpl* RenderFrameImpl::GetLocalRoot() const {
4738 return IsLocalRoot() ? this 4739 return IsLocalRoot() ? this
4739 : RenderFrameImpl::FromWebFrame(frame_->LocalRoot()); 4740 : RenderFrameImpl::FromWebFrame(frame_->LocalRoot());
4740 } 4741 }
4741 4742
4742 // Tell the embedding application that the URL of the active page has changed. 4743 // Tell the embedding application that the URL of the active page has changed.
4743 void RenderFrameImpl::SendDidCommitProvisionalLoad( 4744 void RenderFrameImpl::SendDidCommitProvisionalLoad(
4744 blink::WebFrame* frame, 4745 blink::WebLocalFrame* frame,
4745 blink::WebHistoryCommitType commit_type) { 4746 blink::WebHistoryCommitType commit_type) {
4746 DCHECK_EQ(frame_, frame); 4747 DCHECK_EQ(frame_, frame);
4747 WebDataSource* ds = frame->DataSource(); 4748 WebDataSource* ds = frame->DataSource();
4748 DCHECK(ds); 4749 DCHECK(ds);
4749 4750
4750 const WebURLRequest& request = ds->GetRequest(); 4751 const WebURLRequest& request = ds->GetRequest();
4751 const WebURLResponse& response = ds->GetResponse(); 4752 const WebURLResponse& response = ds->GetResponse();
4752 4753
4753 DocumentState* document_state = DocumentState::FromDataSource(ds); 4754 DocumentState* document_state = DocumentState::FromDataSource(ds);
4754 NavigationStateImpl* navigation_state = 4755 NavigationStateImpl* navigation_state =
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 policy(info.default_policy), 6783 policy(info.default_policy),
6783 replaces_current_history_item(info.replaces_current_history_item), 6784 replaces_current_history_item(info.replaces_current_history_item),
6784 history_navigation_in_new_child_frame( 6785 history_navigation_in_new_child_frame(
6785 info.is_history_navigation_in_new_child_frame), 6786 info.is_history_navigation_in_new_child_frame),
6786 client_redirect(info.is_client_redirect), 6787 client_redirect(info.is_client_redirect),
6787 cache_disabled(info.is_cache_disabled), 6788 cache_disabled(info.is_cache_disabled),
6788 form(info.form), 6789 form(info.form),
6789 source_location(info.source_location) {} 6790 source_location(info.source_location) {}
6790 6791
6791 } // namespace content 6792 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698