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

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 21378002: Support POST in browser navaigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_navigator.cc
===================================================================
--- chrome/browser/ui/browser_navigator.cc (revision 214769)
+++ chrome/browser/ui/browser_navigator.cc (working copy)
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/command_line.h"
+#include "base/memory/ref_counted_memory.h"
#include "base/prefs/pref_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -45,6 +46,7 @@
#endif
using content::GlobalRequestID;
+using content::NavigationController;
using content::WebContents;
class BrowserNavigatorWebContentsAdoption {
@@ -243,7 +245,7 @@
void LoadURLInContents(WebContents* target_contents,
const GURL& url,
chrome::NavigateParams* params) {
- content::NavigationController::LoadURLParams load_url_params(url);
+ NavigationController::LoadURLParams load_url_params(url);
load_url_params.referrer = params->referrer;
load_url_params.transition_type = params->transition;
load_url_params.extra_headers = params->extra_headers;
@@ -257,6 +259,14 @@
} else if (params->is_renderer_initiated) {
load_url_params.is_renderer_initiated = true;
}
+
+ if (params->uses_post) {
+ // Only allows the user-initiated navigation to use POST?
Charlie Reis 2013/08/02 16:36:41 Why is there a question here? Is this unresolved?
Johnny(Jianning) Ding 2013/08/02 23:22:55 Done.
+ load_url_params.load_type =
+ NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST;
+ load_url_params.browser_initiated_post_data =
+ base::RefCountedString::TakeString(&params->post_data);
Charlie Reis 2013/08/02 16:36:41 I agree with joth. Is it possible to use scoped_r
Johnny(Jianning) Ding 2013/08/02 23:22:55 Done.
+ }
target_contents->GetController().LoadURLWithParams(load_url_params);
}
@@ -393,7 +403,8 @@
browser(a_browser),
initiating_profile(NULL),
host_desktop_type(GetHostDesktop(a_browser)),
- should_replace_current_entry(false) {
+ should_replace_current_entry(false),
+ uses_post(false) {
}
NavigateParams::NavigateParams(Browser* a_browser,
@@ -412,7 +423,8 @@
browser(a_browser),
initiating_profile(NULL),
host_desktop_type(GetHostDesktop(a_browser)),
- should_replace_current_entry(false) {
+ should_replace_current_entry(false),
+ uses_post(false) {
}
NavigateParams::NavigateParams(Profile* a_profile,
@@ -433,7 +445,8 @@
browser(NULL),
initiating_profile(a_profile),
host_desktop_type(chrome::GetActiveDesktop()),
- should_replace_current_entry(false) {
+ should_replace_current_entry(false),
+ uses_post(false) {
}
NavigateParams::~NavigateParams() {}
@@ -449,6 +462,8 @@
params.transferred_global_request_id;
nav_params->should_replace_current_entry =
params.should_replace_current_entry;
+ nav_params->uses_post = params.uses_post;
+ nav_params->post_data = params.post_data;
}
void Navigate(NavigateParams* params) {

Powered by Google App Engine
This is Rietveld 408576698