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

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

Issue 2918403003: Move [Provisional]DataSource accessors/methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Added a TODO comment for user agent overrides - https://crbug.com/426555 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 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 3315
3316 DocumentState* document_state = DocumentState::FromDataSource(datasource); 3316 DocumentState* document_state = DocumentState::FromDataSource(datasource);
3317 if (!document_state) { 3317 if (!document_state) {
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 // TODO(lukasza): https://crbug.com/426555: Need OOPIF support for propagating
3326 // user agent overrides.
3325 blink::WebView* webview = render_view_->webview(); 3327 blink::WebView* webview = render_view_->webview();
3326 if (content_initiated && webview && webview->MainFrame() && 3328 if (content_initiated && webview && webview->MainFrame() &&
3327 webview->MainFrame()->IsWebLocalFrame() && 3329 webview->MainFrame()->IsWebLocalFrame() &&
3328 webview->MainFrame()->DataSource()) { 3330 webview->MainFrame()->ToWebLocalFrame()->DataSource()) {
3329 DocumentState* old_document_state = 3331 DocumentState* old_document_state = DocumentState::FromDataSource(
3330 DocumentState::FromDataSource(webview->MainFrame()->DataSource()); 3332 webview->MainFrame()->ToWebLocalFrame()->DataSource());
3331 if (old_document_state) { 3333 if (old_document_state) {
3332 InternalDocumentStateData* internal_data = 3334 InternalDocumentStateData* internal_data =
3333 InternalDocumentStateData::FromDocumentState(document_state); 3335 InternalDocumentStateData::FromDocumentState(document_state);
3334 InternalDocumentStateData* old_internal_data = 3336 InternalDocumentStateData* old_internal_data =
3335 InternalDocumentStateData::FromDocumentState(old_document_state); 3337 InternalDocumentStateData::FromDocumentState(old_document_state);
3336 internal_data->set_is_overriding_user_agent( 3338 internal_data->set_is_overriding_user_agent(
3337 old_internal_data->is_overriding_user_agent()); 3339 old_internal_data->is_overriding_user_agent());
3338 } 3340 }
3339 } 3341 }
3340 3342
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
4548 if (!render_view_->webview() || !render_view_->webview()->MainFrame() || 4550 if (!render_view_->webview() || !render_view_->webview()->MainFrame() ||
4549 render_view_->renderer_preferences_.user_agent_override.empty()) { 4551 render_view_->renderer_preferences_.user_agent_override.empty()) {
4550 return blink::WebString(); 4552 return blink::WebString();
4551 } 4553 }
4552 4554
4553 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource 4555 // 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 4556 // associated with it, so the checks below are not valid. Temporarily
4555 // return early and fix properly as part of https://crbug.com/426555. 4557 // return early and fix properly as part of https://crbug.com/426555.
4556 if (render_view_->webview()->MainFrame()->IsWebRemoteFrame()) 4558 if (render_view_->webview()->MainFrame()->IsWebRemoteFrame())
4557 return blink::WebString(); 4559 return blink::WebString();
4560 WebLocalFrame* main_frame =
4561 render_view_->webview()->MainFrame()->ToWebLocalFrame();
4558 4562
4559 // If we're in the middle of committing a load, the data source we need 4563 // If we're in the middle of committing a load, the data source we need
4560 // will still be provisional. 4564 // will still be provisional.
4561 WebFrame* main_frame = render_view_->webview()->MainFrame();
4562 WebDataSource* data_source = NULL; 4565 WebDataSource* data_source = NULL;
4563 if (main_frame->ProvisionalDataSource()) 4566 if (main_frame->ProvisionalDataSource())
4564 data_source = main_frame->ProvisionalDataSource(); 4567 data_source = main_frame->ProvisionalDataSource();
4565 else 4568 else
4566 data_source = main_frame->DataSource(); 4569 data_source = main_frame->DataSource();
4567 4570
4568 InternalDocumentStateData* internal_data = data_source ? 4571 InternalDocumentStateData* internal_data = data_source ?
4569 InternalDocumentStateData::FromDataSource(data_source) : NULL; 4572 InternalDocumentStateData::FromDataSource(data_source) : NULL;
4570 if (internal_data && internal_data->is_overriding_user_agent()) 4573 if (internal_data && internal_data->is_overriding_user_agent())
4571 return WebString::FromUTF8( 4574 return WebString::FromUTF8(
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4734 return is_local_root; 4737 return is_local_root;
4735 } 4738 }
4736 4739
4737 const RenderFrameImpl* RenderFrameImpl::GetLocalRoot() const { 4740 const RenderFrameImpl* RenderFrameImpl::GetLocalRoot() const {
4738 return IsLocalRoot() ? this 4741 return IsLocalRoot() ? this
4739 : RenderFrameImpl::FromWebFrame(frame_->LocalRoot()); 4742 : RenderFrameImpl::FromWebFrame(frame_->LocalRoot());
4740 } 4743 }
4741 4744
4742 // Tell the embedding application that the URL of the active page has changed. 4745 // Tell the embedding application that the URL of the active page has changed.
4743 void RenderFrameImpl::SendDidCommitProvisionalLoad( 4746 void RenderFrameImpl::SendDidCommitProvisionalLoad(
4744 blink::WebFrame* frame, 4747 blink::WebLocalFrame* frame,
4745 blink::WebHistoryCommitType commit_type) { 4748 blink::WebHistoryCommitType commit_type) {
4746 DCHECK_EQ(frame_, frame); 4749 DCHECK_EQ(frame_, frame);
4747 WebDataSource* ds = frame->DataSource(); 4750 WebDataSource* ds = frame->DataSource();
4748 DCHECK(ds); 4751 DCHECK(ds);
4749 4752
4750 const WebURLRequest& request = ds->GetRequest(); 4753 const WebURLRequest& request = ds->GetRequest();
4751 const WebURLResponse& response = ds->GetResponse(); 4754 const WebURLResponse& response = ds->GetResponse();
4752 4755
4753 DocumentState* document_state = DocumentState::FromDataSource(ds); 4756 DocumentState* document_state = DocumentState::FromDataSource(ds);
4754 NavigationStateImpl* navigation_state = 4757 NavigationStateImpl* navigation_state =
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 policy(info.default_policy), 6785 policy(info.default_policy),
6783 replaces_current_history_item(info.replaces_current_history_item), 6786 replaces_current_history_item(info.replaces_current_history_item),
6784 history_navigation_in_new_child_frame( 6787 history_navigation_in_new_child_frame(
6785 info.is_history_navigation_in_new_child_frame), 6788 info.is_history_navigation_in_new_child_frame),
6786 client_redirect(info.is_client_redirect), 6789 client_redirect(info.is_client_redirect),
6787 cache_disabled(info.is_cache_disabled), 6790 cache_disabled(info.is_cache_disabled),
6788 form(info.form), 6791 form(info.form),
6789 source_location(info.source_location) {} 6792 source_location(info.source_location) {}
6790 6793
6791 } // namespace content 6794 } // 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