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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 1227793006: Navigations are renderer-initiated if no WebUI bindings present. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply WebUI bindings criterion to entire block. Created 5 years, 5 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/browser/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 OpenURLParams params( 555 OpenURLParams params(
556 dest_url, referrer, frame_tree_node_id, disposition, page_transition, 556 dest_url, referrer, frame_tree_node_id, disposition, page_transition,
557 true /* is_renderer_initiated */); 557 true /* is_renderer_initiated */);
558 params.source_site_instance = source_site_instance; 558 params.source_site_instance = source_site_instance;
559 if (redirect_chain.size() > 0) 559 if (redirect_chain.size() > 0)
560 params.redirect_chain = redirect_chain; 560 params.redirect_chain = redirect_chain;
561 params.transferred_global_request_id = transferred_global_request_id; 561 params.transferred_global_request_id = transferred_global_request_id;
562 params.should_replace_current_entry = should_replace_current_entry; 562 params.should_replace_current_entry = should_replace_current_entry;
563 params.user_gesture = user_gesture; 563 params.user_gesture = user_gesture;
564 564
565 if (GetRenderManager(render_frame_host)->web_ui()) { 565 // Note: extensions don't have bindings, so will not be affected by the
Charlie Reis 2015/07/15 20:38:00 Extensions aren't a concept in content/, so I don'
566 // Web UI pages sometimes want to override the page transition type for 566 // following code.
567 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for 567 int enabled_bindings =
Charlie Reis 2015/07/15 20:38:00 Looking deeper, this change doesn't look safe. Ne
kmadhusu 2015/07/17 04:06:47 mathp@/fserb@: Please address this comment.
fserb 2015/07/17 15:59:11 Yep. We still rely on this when we analyse history
568 // automatically generated suggestions). We don't override other types 568 render_frame_host->render_view_host()->GetEnabledBindings();
569 // like TYPED because they have different implications (e.g., autocomplete). 569 if (enabled_bindings & content::BINDINGS_POLICY_WEB_UI) {
570 if (ui::PageTransitionCoreTypeIs( 570 // Note that we hide the referrer for Web UI pages. We don't really
Charlie Reis 2015/07/15 20:37:59 nit: for Web UI pages with bindings.
571 params.transition, ui::PAGE_TRANSITION_LINK))
572 params.transition =
573 GetRenderManager(render_frame_host)->web_ui()->
574 GetLinkTransitionType();
575
576 // Note also that we hide the referrer for Web UI pages. We don't really
577 // want web sites to see a referrer of "chrome://blah" (and some 571 // want web sites to see a referrer of "chrome://blah" (and some
578 // chrome: URLs might have search terms or other stuff we don't want to 572 // chrome: URLs might have search terms or other stuff we don't want to
579 // send to the site), so we send no referrer. 573 // send to the site), so we send no referrer.
580 params.referrer = Referrer(); 574 params.referrer = Referrer();
Charlie Reis 2015/07/15 20:38:00 @kalman: Should extension processes be sending a n
not at google - send to devlin 2015/07/15 20:42:03 We should maintain the old, existing behavior.
581 575
582 // Navigations in Web UI pages count as browser-initiated navigations. 576 // Navigations in Web UI pages (with WebUI bindings) count as
Charlie Reis 2015/07/15 20:38:00 nit: Web UI
577 // browser-initiated navigations.
583 params.is_renderer_initiated = false; 578 params.is_renderer_initiated = false;
584 } 579 }
585 580
586 if (delegate_) 581 if (delegate_)
587 delegate_->RequestOpenURL(render_frame_host, params); 582 delegate_->RequestOpenURL(render_frame_host, params);
588 } 583 }
589 584
590 // PlzNavigate 585 // PlzNavigate
591 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, 586 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
592 bool proceed) { 587 bool proceed) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 899 entry->set_should_replace_entry(pending_entry->should_replace_entry());
905 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 900 entry->SetRedirectChain(pending_entry->GetRedirectChain());
906 } 901 }
907 controller_->SetPendingEntry(entry.Pass()); 902 controller_->SetPendingEntry(entry.Pass());
908 if (delegate_) 903 if (delegate_)
909 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 904 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
910 } 905 }
911 } 906 }
912 907
913 } // namespace content 908 } // 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