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 "chrome/browser/ui/browser_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 load_url_params.source_site_instance = params->source_site_instance; | 257 load_url_params.source_site_instance = params->source_site_instance; |
258 load_url_params.referrer = params->referrer; | 258 load_url_params.referrer = params->referrer; |
259 load_url_params.frame_tree_node_id = params->frame_tree_node_id; | 259 load_url_params.frame_tree_node_id = params->frame_tree_node_id; |
260 load_url_params.redirect_chain = params->redirect_chain; | 260 load_url_params.redirect_chain = params->redirect_chain; |
261 load_url_params.transition_type = params->transition; | 261 load_url_params.transition_type = params->transition; |
262 load_url_params.extra_headers = params->extra_headers; | 262 load_url_params.extra_headers = params->extra_headers; |
263 load_url_params.should_replace_current_entry = | 263 load_url_params.should_replace_current_entry = |
264 params->should_replace_current_entry; | 264 params->should_replace_current_entry; |
265 load_url_params.is_renderer_initiated = params->is_renderer_initiated; | 265 load_url_params.is_renderer_initiated = params->is_renderer_initiated; |
266 | 266 |
267 // Only allows the browser-initiated navigation to use POST. | 267 if (params->uses_post) { |
268 if (params->uses_post && !params->is_renderer_initiated) { | 268 load_url_params.load_type = NavigationController::LOAD_TYPE_HTTP_POST; |
269 load_url_params.load_type = | 269 load_url_params.post_data = params->post_data; |
270 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; | |
271 load_url_params.browser_initiated_post_data = | |
272 params->browser_initiated_post_data; | |
273 } | 270 } |
| 271 |
274 target_contents->GetController().LoadURLWithParams(load_url_params); | 272 target_contents->GetController().LoadURLWithParams(load_url_params); |
275 } | 273 } |
276 | 274 |
277 // This class makes sure the Browser object held in |params| is made visible | 275 // This class makes sure the Browser object held in |params| is made visible |
278 // by the time it goes out of scope, provided |params| wants it to be shown. | 276 // by the time it goes out of scope, provided |params| wants it to be shown. |
279 class ScopedBrowserShower { | 277 class ScopedBrowserShower { |
280 public: | 278 public: |
281 explicit ScopedBrowserShower(chrome::NavigateParams* params) | 279 explicit ScopedBrowserShower(chrome::NavigateParams* params) |
282 : params_(params) { | 280 : params_(params) { |
283 } | 281 } |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 bool reverse_on_redirect = false; | 644 bool reverse_on_redirect = false; |
647 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 645 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
648 &rewritten_url, browser_context, &reverse_on_redirect); | 646 &rewritten_url, browser_context, &reverse_on_redirect); |
649 | 647 |
650 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 648 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
651 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 649 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
652 rewritten_url.host() == chrome::kChromeUIUberHost); | 650 rewritten_url.host() == chrome::kChromeUIUberHost); |
653 } | 651 } |
654 | 652 |
655 } // namespace chrome | 653 } // namespace chrome |
OLD | NEW |