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

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

Issue 1841403002: Carry over user-agent override when opening new windows Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 child_render_frame->in_frame_tree_ = true; 2618 child_render_frame->in_frame_tree_ = true;
2619 child_render_frame->Initialize(); 2619 child_render_frame->Initialize();
2620 2620
2621 return web_frame; 2621 return web_frame;
2622 } 2622 }
2623 2623
2624 void RenderFrameImpl::didChangeOpener(blink::WebFrame* opener) { 2624 void RenderFrameImpl::didChangeOpener(blink::WebFrame* opener) {
2625 // Only a local frame should be able to update another frame's opener. 2625 // Only a local frame should be able to update another frame's opener.
2626 DCHECK(!opener || opener->isWebLocalFrame()); 2626 DCHECK(!opener || opener->isWebLocalFrame());
2627 2627
2628 // Carry over the user agent override flag, if it exists.
2629 blink::WebView* webview = render_view_->webview();
dcheng 2016/03/31 05:24:18 This doesn't get called at all when creating a new
2630 if (opener && !pending_navigation_params_.get() && webview &&
2631 webview->mainFrame() && webview->mainFrame()->isWebLocalFrame() &&
2632 webview->mainFrame()->dataSource()) {
2633 if (webview->mainFrame()->dataSource()->request().url().isEmpty() &&
2634 opener->dataSource()) {
2635 DocumentState* old_document_state =
2636 DocumentState::FromDataSource(opener->dataSource());
2637 InternalDocumentStateData* internal_data =
2638 InternalDocumentStateData::FromDocumentState(
2639 DocumentState::FromDataSource(
2640 webview->mainFrame()->dataSource()));
2641 InternalDocumentStateData* old_internal_data =
2642 InternalDocumentStateData::FromDocumentState(old_document_state);
2643 internal_data->set_is_overriding_user_agent(
2644 old_internal_data->is_overriding_user_agent());
2645 }
2646 }
2647
2628 int opener_routing_id = opener ? 2648 int opener_routing_id = opener ?
2629 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() : 2649 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() :
2630 MSG_ROUTING_NONE; 2650 MSG_ROUTING_NONE;
2631 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); 2651 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id));
2632 } 2652 }
2633 2653
2634 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) { 2654 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) {
2635 // NOTE: This function is called on the frame that is being detached and not 2655 // NOTE: This function is called on the frame that is being detached and not
2636 // the parent frame. This is different from createChildFrame() which is 2656 // the parent frame. This is different from createChildFrame() which is
2637 // called on the parent frame. 2657 // called on the parent frame.
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
6013 int match_count, 6033 int match_count,
6014 int ordinal, 6034 int ordinal,
6015 const WebRect& selection_rect, 6035 const WebRect& selection_rect,
6016 bool final_status_update) { 6036 bool final_status_update) {
6017 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6037 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6018 selection_rect, ordinal, 6038 selection_rect, ordinal,
6019 final_status_update)); 6039 final_status_update));
6020 } 6040 }
6021 6041
6022 } // namespace content 6042 } // 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