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

Unified Diff: components/html_viewer/html_viewer.cc

Issue 1161463004: Move URL Loader creation to a separate factory object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/html_viewer/html_viewer.cc
diff --git a/components/html_viewer/html_viewer.cc b/components/html_viewer/html_viewer.cc
index b6fe8bf82703a037de25996b7c076e39481ae2d1..2d30884c80a2a78872bdb620280fe16b501e8c0d 100644
--- a/components/html_viewer/html_viewer.cc
+++ b/components/html_viewer/html_viewer.cc
@@ -20,6 +20,7 @@
#include "mojo/application/public/interfaces/content_handler.mojom.h"
#include "mojo/common/common_type_converters.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
+#include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/mojo/src/mojo/public/c/system/main.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
@@ -59,7 +60,10 @@ class HTMLViewerApplication : public mojo::Application {
shell_ = shell.Pass();
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = mojo::String::From("mojo:network_service");
- setup_->app()->ConnectToService(request.Pass(), &network_service_);
+ mojo::ApplicationConnection* connection =
+ setup_->app()->ConnectToApplication(request.Pass());
+ connection->ConnectToService(&network_service_);
+ connection->ConnectToService(&url_loader_factory_);
}
void AcceptConnection(const String& requestor_url,
@@ -71,7 +75,7 @@ class HTMLViewerApplication : public mojo::Application {
initial_response_.Pass());
} else {
URLLoaderPtr loader;
- network_service_->CreateURLLoader(GetProxy(&loader));
+ url_loader_factory_->CreateURLLoader(GetProxy(&loader));
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = url_;
request->auto_follow_redirects = true;
@@ -107,6 +111,7 @@ class HTMLViewerApplication : public mojo::Application {
mojo::StrongBinding<mojo::Application> binding_;
ShellPtr shell_;
mojo::NetworkServicePtr network_service_;
+ mojo::URLLoaderFactoryPtr url_loader_factory_;
URLResponsePtr initial_response_;
Setup* setup_;

Powered by Google App Engine
This is Rietveld 408576698