Merge ResourceRequestBodyImpl and ResourceRequestBody.

https://codereview.chromium.org/2954343005
This commit is contained in:
Aleksei Kuzmin 2017-08-12 20:45:31 +03:00 committed by Cheng Zhao
parent b77b67bfbe
commit ba6e8b4dff
8 changed files with 24 additions and 24 deletions

View file

@ -655,7 +655,7 @@ void App::OnCreateWindow(
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const std::vector<std::string>& features, const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body, const scoped_refptr<content::ResourceRequestBody>& body,
int render_process_id, int render_process_id,
int render_frame_id) { int render_frame_id) {
v8::Locker locker(isolate()); v8::Locker locker(isolate());

View file

@ -80,7 +80,7 @@ class App : public AtomBrowserClient::Delegate,
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const std::vector<std::string>& features, const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body, const scoped_refptr<content::ResourceRequestBody>& body,
int render_process_id, int render_process_id,
int render_frame_id); int render_frame_id);

View file

@ -493,7 +493,7 @@ void WebContents::OnCreateWindow(
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const std::vector<std::string>& features, const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body) { const scoped_refptr<content::ResourceRequestBody>& body) {
if (type_ == BROWSER_WINDOW || type_ == OFF_SCREEN) if (type_ == BROWSER_WINDOW || type_ == OFF_SCREEN)
Emit("-new-window", target_url, frame_name, disposition, features, body); Emit("-new-window", target_url, frame_name, disposition, features, body);
else else
@ -1042,7 +1042,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
if (options.Get("extraHeaders", &extra_headers)) if (options.Get("extraHeaders", &extra_headers))
params.extra_headers = extra_headers; params.extra_headers = extra_headers;
scoped_refptr<content::ResourceRequestBodyImpl> body; scoped_refptr<content::ResourceRequestBody> body;
if (options.Get("postData", &body)) { if (options.Get("postData", &body)) {
params.post_data = body; params.post_data = body;
params.load_type = content::NavigationController::LOAD_TYPE_HTTP_POST; params.load_type = content::NavigationController::LOAD_TYPE_HTTP_POST;

View file

@ -30,7 +30,7 @@ class InspectableWebContents;
} }
namespace content { namespace content {
class ResourceRequestBodyImpl; class ResourceRequestBody;
} }
namespace mate { namespace mate {
@ -208,7 +208,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const std::vector<std::string>& features, const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body); const scoped_refptr<content::ResourceRequestBody>& body);
// Returns the web preferences of current WebContents. // Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate); v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);

View file

@ -30,7 +30,6 @@
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h" #include "chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h"
#include "chrome/browser/speech/tts_message_filter.h" #include "chrome/browser/speech/tts_message_filter.h"
#include "content/common/resource_request_body_impl.h"
#include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
@ -39,6 +38,7 @@
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/resource_request_body.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_cert_request_info.h"
@ -345,7 +345,7 @@ bool AtomBrowserClient::CanCreateWindow(
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features, const blink::mojom::WindowFeatures& features,
const std::vector<std::string>& additional_features, const std::vector<std::string>& additional_features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body, const scoped_refptr<content::ResourceRequestBody>& body,
bool user_gesture, bool user_gesture,
bool opener_suppressed, bool opener_suppressed,
content::ResourceContext* context, content::ResourceContext* context,

View file

@ -93,7 +93,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features, const blink::mojom::WindowFeatures& features,
const std::vector<std::string>& additional_features, const std::vector<std::string>& additional_features,
const scoped_refptr<content::ResourceRequestBodyImpl>& body, const scoped_refptr<content::ResourceRequestBody>& body,
bool user_gesture, bool user_gesture,
bool opener_suppressed, bool opener_suppressed,
content::ResourceContext* context, content::ResourceContext* context,

View file

@ -15,12 +15,12 @@
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/ui_base_types_converter.h" #include "atom/common/native_mate_converters/ui_base_types_converter.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "content/common/resource_request_body_impl.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/context_menu_params.h" #include "content/public/common/context_menu_params.h"
#include "content/public/common/resource_request_body.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
using content::ResourceRequestBodyImpl; using content::ResourceRequestBody;
namespace { namespace {
@ -203,9 +203,9 @@ bool Converter<content::StopFindAction>::FromV8(
// static // static
v8::Local<v8::Value> v8::Local<v8::Value>
Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8( Converter<scoped_refptr<ResourceRequestBody>>::ToV8(
v8::Isolate* isolate, v8::Isolate* isolate,
const scoped_refptr<ResourceRequestBodyImpl>& val) { const scoped_refptr<ResourceRequestBody>& val) {
if (!val) if (!val)
return v8::Null(isolate); return v8::Null(isolate);
std::unique_ptr<base::ListValue> list(new base::ListValue); std::unique_ptr<base::ListValue> list(new base::ListValue);
@ -213,13 +213,13 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
std::unique_ptr<base::DictionaryValue> post_data_dict( std::unique_ptr<base::DictionaryValue> post_data_dict(
new base::DictionaryValue); new base::DictionaryValue);
auto type = element.type(); auto type = element.type();
if (type == ResourceRequestBodyImpl::Element::TYPE_BYTES) { if (type == ResourceRequestBody::Element::TYPE_BYTES) {
std::unique_ptr<base::Value> bytes( std::unique_ptr<base::Value> bytes(
base::Value::CreateWithCopiedBuffer( base::Value::CreateWithCopiedBuffer(
element.bytes(), static_cast<size_t>(element.length()))); element.bytes(), static_cast<size_t>(element.length())));
post_data_dict->SetString("type", "rawData"); post_data_dict->SetString("type", "rawData");
post_data_dict->Set("bytes", std::move(bytes)); post_data_dict->Set("bytes", std::move(bytes));
} else if (type == ResourceRequestBodyImpl::Element::TYPE_FILE) { } else if (type == ResourceRequestBody::Element::TYPE_FILE) {
post_data_dict->SetString("type", "file"); post_data_dict->SetString("type", "file");
post_data_dict->SetStringWithoutPathExpansion( post_data_dict->SetStringWithoutPathExpansion(
"filePath", element.path().AsUTF8Unsafe()); "filePath", element.path().AsUTF8Unsafe());
@ -227,7 +227,7 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
post_data_dict->SetInteger("length", static_cast<int>(element.length())); post_data_dict->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble( post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT()); "modificationTime", element.expected_modification_time().ToDoubleT());
} else if (type == ResourceRequestBodyImpl::Element::TYPE_FILE_FILESYSTEM) { } else if (type == ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM) {
post_data_dict->SetString("type", "fileSystem"); post_data_dict->SetString("type", "fileSystem");
post_data_dict->SetStringWithoutPathExpansion( post_data_dict->SetStringWithoutPathExpansion(
"fileSystemURL", element.filesystem_url().spec()); "fileSystemURL", element.filesystem_url().spec());
@ -235,7 +235,7 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
post_data_dict->SetInteger("length", static_cast<int>(element.length())); post_data_dict->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble( post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT()); "modificationTime", element.expected_modification_time().ToDoubleT());
} else if (type == ResourceRequestBodyImpl::Element::TYPE_BLOB) { } else if (type == ResourceRequestBody::Element::TYPE_BLOB) {
post_data_dict->SetString("type", "blob"); post_data_dict->SetString("type", "blob");
post_data_dict->SetString("blobUUID", element.blob_uuid()); post_data_dict->SetString("blobUUID", element.blob_uuid());
} }
@ -245,14 +245,14 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
} }
// static // static
bool Converter<scoped_refptr<ResourceRequestBodyImpl>>::FromV8( bool Converter<scoped_refptr<ResourceRequestBody>>::FromV8(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Local<v8::Value> val, v8::Local<v8::Value> val,
scoped_refptr<ResourceRequestBodyImpl>* out) { scoped_refptr<ResourceRequestBody>* out) {
std::unique_ptr<base::ListValue> list(new base::ListValue); std::unique_ptr<base::ListValue> list(new base::ListValue);
if (!ConvertFromV8(isolate, val, list.get())) if (!ConvertFromV8(isolate, val, list.get()))
return false; return false;
*out = new content::ResourceRequestBodyImpl(); *out = new content::ResourceRequestBody();
for (size_t i = 0; i < list->GetSize(); ++i) { for (size_t i = 0; i < list->GetSize(); ++i) {
base::DictionaryValue* dict = nullptr; base::DictionaryValue* dict = nullptr;
std::string type; std::string type;

View file

@ -15,7 +15,7 @@
namespace content { namespace content {
struct ContextMenuParams; struct ContextMenuParams;
class ResourceRequestBodyImpl; class ResourceRequestBody;
class WebContents; class WebContents;
} }
@ -49,12 +49,12 @@ struct Converter<content::PermissionType> {
}; };
template<> template<>
struct Converter<scoped_refptr<content::ResourceRequestBodyImpl>> { struct Converter<scoped_refptr<content::ResourceRequestBody>> {
static v8::Local<v8::Value> ToV8( static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate, v8::Isolate* isolate,
const scoped_refptr<content::ResourceRequestBodyImpl>& val); const scoped_refptr<content::ResourceRequestBody>& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
scoped_refptr<content::ResourceRequestBodyImpl>* out); scoped_refptr<content::ResourceRequestBody>* out);
}; };
template<> template<>