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

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

Issue 2399463007: AssociatedURLLoader shouldn't derive from WebURLLoader (Closed)
Patch Set: Rebase 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 cd6aa0cfa93c5e892575cd30100b4ea67883d199..a05a25552bebfebf96294808ded06796b79478f4 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"
@@ -316,9 +317,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
@@ -327,8 +329,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);
}
@@ -1013,8 +1015,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.
@@ -1366,8 +1368,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);
@@ -1518,8 +1520,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);
@@ -1570,10 +1572,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,
@@ -1595,8 +1597,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;
@@ -1658,11 +1659,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_,
@@ -1671,9 +1668,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_))
@@ -1681,8 +1676,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);
@@ -1690,7 +1684,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_;
@@ -1722,8 +1716,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);
« no previous file with comments | « components/nacl/renderer/manifest_downloader.cc ('k') | content/public/renderer/associated_resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698