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

Side by Side Diff: content/public/browser/web_contents_delegate.cc

Issue 1473423002: Provide default implementation for WebContentsDelegate::OpenURLFromTab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 5 years 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 | content/shell/browser/shell.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/browser/web_contents_delegate.h" 5 #include "content/public/browser/web_contents_delegate.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/security_style_explanations.h" 11 #include "content/public/browser/security_style_explanations.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/common/bindings_policy.h" 13 #include "content/public/common/bindings_policy.h"
14 #include "content/public/common/security_style.h" 14 #include "content/public/common/security_style.h"
15 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 WebContentsDelegate::WebContentsDelegate() { 20 WebContentsDelegate::WebContentsDelegate() {
21 } 21 }
22 22
23 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, 23 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source,
24 const OpenURLParams& params) { 24 const OpenURLParams& params) {
25 return nullptr; 25 // This default implementation only handles CURRENT_TAB.
26 if (params.disposition != CURRENT_TAB)
27 return nullptr;
28
29 NavigationController::LoadURLParams load_url_params(params.url);
30 load_url_params.source_site_instance = params.source_site_instance;
31 load_url_params.transition_type = params.transition;
32 load_url_params.frame_tree_node_id = params.frame_tree_node_id;
33 load_url_params.referrer = params.referrer;
34 load_url_params.redirect_chain = params.redirect_chain;
35 load_url_params.extra_headers = params.extra_headers;
36 load_url_params.is_renderer_initiated = params.is_renderer_initiated;
37 load_url_params.transferred_global_request_id =
38 params.transferred_global_request_id;
39 load_url_params.should_replace_current_entry =
40 params.should_replace_current_entry;
41
42 // Only allows the browser-initiated navigation to use POST.
43 if (params.uses_post && !params.is_renderer_initiated) {
44 load_url_params.load_type =
45 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST;
46 load_url_params.browser_initiated_post_data =
47 params.browser_initiated_post_data;
48 }
49
50 source->GetController().LoadURLWithParams(load_url_params);
51 return source;
26 } 52 }
27 53
28 bool WebContentsDelegate::IsPopupOrPanel(const WebContents* source) const { 54 bool WebContentsDelegate::IsPopupOrPanel(const WebContents* source) const {
29 return false; 55 return false;
30 } 56 }
31 57
32 bool WebContentsDelegate::CanOverscrollContent() const { return false; } 58 bool WebContentsDelegate::CanOverscrollContent() const { return false; }
33 59
34 gfx::Rect WebContentsDelegate::GetRootWindowResizerRect() const { 60 gfx::Rect WebContentsDelegate::GetRootWindowResizerRect() const {
35 return gfx::Rect(); 61 return gfx::Rect();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 SecurityStyleExplanations* security_style_explanations) { 274 SecurityStyleExplanations* security_style_explanations) {
249 return content::SECURITY_STYLE_UNKNOWN; 275 return content::SECURITY_STYLE_UNKNOWN;
250 } 276 }
251 277
252 void WebContentsDelegate::ShowCertificateViewerInDevTools( 278 void WebContentsDelegate::ShowCertificateViewerInDevTools(
253 WebContents* web_contents, 279 WebContents* web_contents,
254 int cert_id) { 280 int cert_id) {
255 } 281 }
256 282
257 } // namespace content 283 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/browser/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698