| OLD | NEW |
| 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/security_style_explanations.h" | 12 #include "content/public/browser/security_style_explanations.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/common/bindings_policy.h" | 14 #include "content/public/common/bindings_policy.h" |
| 15 #include "content/public/common/security_style.h" | 15 #include "content/public/common/security_style.h" |
| 16 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 WebContentsDelegate::WebContentsDelegate() { | 21 WebContentsDelegate::WebContentsDelegate() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, | 24 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, |
| 25 const OpenURLParams& params) { | 25 const OpenURLParams& params) { |
| 26 // This default implementation only handles CURRENT_TAB. | 26 return nullptr; |
| 27 if (params.disposition != CURRENT_TAB) | |
| 28 return nullptr; | |
| 29 | |
| 30 NavigationController::LoadURLParams load_url_params(params.url); | |
| 31 load_url_params.source_site_instance = params.source_site_instance; | |
| 32 load_url_params.transition_type = params.transition; | |
| 33 load_url_params.frame_tree_node_id = params.frame_tree_node_id; | |
| 34 load_url_params.referrer = params.referrer; | |
| 35 load_url_params.redirect_chain = params.redirect_chain; | |
| 36 load_url_params.extra_headers = params.extra_headers; | |
| 37 load_url_params.is_renderer_initiated = params.is_renderer_initiated; | |
| 38 load_url_params.transferred_global_request_id = | |
| 39 params.transferred_global_request_id; | |
| 40 load_url_params.should_replace_current_entry = | |
| 41 params.should_replace_current_entry; | |
| 42 | |
| 43 // Only allows the browser-initiated navigation to use POST. | |
| 44 if (params.uses_post && !params.is_renderer_initiated) { | |
| 45 load_url_params.load_type = | |
| 46 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; | |
| 47 load_url_params.browser_initiated_post_data = | |
| 48 params.browser_initiated_post_data; | |
| 49 } | |
| 50 | |
| 51 source->GetController().LoadURLWithParams(load_url_params); | |
| 52 return source; | |
| 53 } | 27 } |
| 54 | 28 |
| 55 bool WebContentsDelegate::ShouldTransferNavigation() { | 29 bool WebContentsDelegate::ShouldTransferNavigation() { |
| 56 return true; | 30 return true; |
| 57 } | 31 } |
| 58 | 32 |
| 59 bool WebContentsDelegate::IsPopupOrPanel(const WebContents* source) const { | 33 bool WebContentsDelegate::IsPopupOrPanel(const WebContents* source) const { |
| 60 return false; | 34 return false; |
| 61 } | 35 } |
| 62 | 36 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 SecurityStyleExplanations* security_style_explanations) { | 253 SecurityStyleExplanations* security_style_explanations) { |
| 280 return content::SECURITY_STYLE_UNKNOWN; | 254 return content::SECURITY_STYLE_UNKNOWN; |
| 281 } | 255 } |
| 282 | 256 |
| 283 void WebContentsDelegate::ShowCertificateViewerInDevTools( | 257 void WebContentsDelegate::ShowCertificateViewerInDevTools( |
| 284 WebContents* web_contents, | 258 WebContents* web_contents, |
| 285 int cert_id) { | 259 int cert_id) { |
| 286 } | 260 } |
| 287 | 261 |
| 288 } // namespace content | 262 } // namespace content |
| OLD | NEW |