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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 2399463007: AssociatedURLLoader shouldn't derive from WebURLLoader (Closed)
Patch Set: Addressed #38 Created 4 years, 2 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: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index c11b63ffc2f8952b305a7748eace7a66e4b14b2a..0cb4cfedba6f8e12a58d60bf97f16710f5c4dd2a 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -63,12 +63,13 @@
#include "ppapi/shared_impl/var_tracker.h"
#include "ppapi/thunk/enter.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebURLLoader.h"
+#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
+#include "third_party/WebKit/public/web/WebAssociatedURLLoader.h"
+#include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
-#include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
#if defined(OS_WIN)
#include "base/win/scoped_handle.h"
@@ -328,9 +329,10 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy);
};
-blink::WebURLLoader* CreateWebURLLoader(const blink::WebDocument& document,
- const GURL& gurl) {
- blink::WebURLLoaderOptions options;
+blink::WebAssociatedURLLoader* CreateAssociatedURLLoader(
+ const blink::WebDocument& document,
+ const GURL& gurl) {
+ blink::WebAssociatedURLLoaderOptions options;
options.untrustedHTTP = true;
// Options settings here follow the original behavior in the trusted
@@ -339,8 +341,8 @@ blink::WebURLLoader* CreateWebURLLoader(const blink::WebDocument& document,
options.allowCredentials = true;
} else {
// Allow CORS.
- options.crossOriginRequestPolicy =
- blink::WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
+ options.crossOriginRequestPolicy = blink::WebAssociatedURLLoaderOptions::
+ CrossOriginRequestPolicyUseAccessControl;
}
return document.frame()->createAssociatedURLLoader(options);
}
@@ -1025,8 +1027,8 @@ void DownloadManifestToBuffer(PP_Instance instance,
plugin_instance->GetContainer()->document();
const GURL& gurl = load_manager->manifest_base_url();
- std::unique_ptr<blink::WebURLLoader> url_loader(
- CreateWebURLLoader(document, gurl));
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader(
+ CreateAssociatedURLLoader(document, gurl));
blink::WebURLRequest request = CreateWebURLRequest(document, gurl);
// ManifestDownloader deletes itself after invoking the callback.
@@ -1378,8 +1380,8 @@ void PPBNaClPrivate::DownloadNexe(PP_Instance instance,
}
const blink::WebDocument& document =
plugin_instance->GetContainer()->document();
- std::unique_ptr<blink::WebURLLoader> url_loader(
- CreateWebURLLoader(document, gurl));
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader(
+ CreateAssociatedURLLoader(document, gurl));
blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl);
ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance);
@@ -1530,8 +1532,8 @@ void DownloadFile(PP_Instance instance,
}
const blink::WebDocument& document =
plugin_instance->GetContainer()->document();
- std::unique_ptr<blink::WebURLLoader> url_loader(
- CreateWebURLLoader(document, gurl));
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader(
+ CreateAssociatedURLLoader(document, gurl));
blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl);
ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance);
@@ -1582,10 +1584,10 @@ namespace {
// PexeDownloader is responsible for deleting itself when the download
// finishes.
-class PexeDownloader : public blink::WebURLLoaderClient {
+class PexeDownloader : public blink::WebAssociatedURLLoaderClient {
public:
PexeDownloader(PP_Instance instance,
- std::unique_ptr<blink::WebURLLoader> url_loader,
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader,
const std::string& pexe_url,
int32_t pexe_opt_level,
bool use_subzero,
@@ -1607,8 +1609,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
}
private:
- void didReceiveResponse(blink::WebURLLoader* loader,
- const blink::WebURLResponse& response) override {
+ void didReceiveResponse(const blink::WebURLResponse& response) override {
success_ = (response.httpStatusCode() == 200);
if (!success_)
return;
@@ -1670,11 +1671,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
url_loader_->setDefersLoading(false);
}
- void didReceiveData(blink::WebURLLoader* loader,
- const char* data,
- int data_length,
- int encoded_data_length,
- int encoded_body_length) override {
+ void didReceiveData(const char* data, int data_length) override {
if (content::PepperPluginInstance::Get(instance_)) {
// Stream the data we received to the stream callback.
stream_handler_->DidStreamData(stream_handler_user_data_,
@@ -1683,9 +1680,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
}
}
- void didFinishLoading(blink::WebURLLoader* loader,
- double finish_time,
- int64_t total_encoded_data_length) override {
+ void didFinishLoading(double finish_time) override {
int32_t result = success_ ? PP_OK : PP_ERROR_FAILED;
if (content::PepperPluginInstance::Get(instance_))
@@ -1693,8 +1688,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
delete this;
}
- void didFail(blink::WebURLLoader* loader,
- const blink::WebURLError& error) override {
+ void didFail(const blink::WebURLError& error) override {
if (content::PepperPluginInstance::Get(instance_))
stream_handler_->DidFinishStream(stream_handler_user_data_,
PP_ERROR_FAILED);
@@ -1702,7 +1696,7 @@ class PexeDownloader : public blink::WebURLLoaderClient {
}
PP_Instance instance_;
- std::unique_ptr<blink::WebURLLoader> url_loader_;
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader_;
std::string pexe_url_;
int32_t pexe_opt_level_;
bool use_subzero_;
@@ -1734,8 +1728,8 @@ void PPBNaClPrivate::StreamPexe(PP_Instance instance,
GURL gurl(pexe_url);
const blink::WebDocument& document =
plugin_instance->GetContainer()->document();
- std::unique_ptr<blink::WebURLLoader> url_loader(
- CreateWebURLLoader(document, gurl));
+ std::unique_ptr<blink::WebAssociatedURLLoader> url_loader(
+ CreateAssociatedURLLoader(document, gurl));
PexeDownloader* downloader =
new PexeDownloader(instance, std::move(url_loader), pexe_url, opt_level,
PP_ToBool(use_subzero), handler, handler_user_data);

Powered by Google App Engine
This is Rietveld 408576698