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

Unified Diff: chrome/browser/net/mojo_app_proxy_resolver_factory.cc

Issue 1128453004: Embed a simple Mojo shell in content (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: chrome/browser/net/mojo_app_proxy_resolver_factory.cc
diff --git a/chrome/browser/net/mojo_app_proxy_resolver_factory.cc b/chrome/browser/net/mojo_app_proxy_resolver_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4a8b7a93d33862dfe73b1a2191a12e37356e1f07
--- /dev/null
+++ b/chrome/browser/net/mojo_app_proxy_resolver_factory.cc
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/mojo_app_proxy_resolver_factory.h"
+
+#include "base/logging.h"
+#include "base/memory/singleton.h"
+#include "chrome/common/application_urls.h"
+#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/mojo_app_connection.h"
+#include "url/gurl.h"
+
+// static
+MojoAppProxyResolverFactory* MojoAppProxyResolverFactory::GetInstance() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ return Singleton<MojoAppProxyResolverFactory,
+ LeakySingletonTraits<MojoAppProxyResolverFactory>>::get();
+}
+
+MojoAppProxyResolverFactory::MojoAppProxyResolverFactory() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+}
+
+MojoAppProxyResolverFactory::~MojoAppProxyResolverFactory() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+}
+
+void MojoAppProxyResolverFactory::CreateResolver(
+ const mojo::String& pac_script,
+ mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
+ net::interfaces::HostResolverPtr host_resolver,
+ net::interfaces::ProxyResolverFactoryRequestClientPtr client) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ if (!resolver_factory_) {
+ content::MojoAppConnection proxy_app(
+ (GURL(application_urls::kProxyResolver)));
+ proxy_app.ConnectToService(&resolver_factory_);
+ }
+ resolver_factory_->CreateResolver(pac_script, req.Pass(),
+ host_resolver.Pass(), client.Pass());
+}
+
+void MojoAppProxyResolverFactory::OnConnectionError() {
+ DVLOG(1) << "Disconnection from utility process detected";
+ resolver_factory_.reset();
+}

Powered by Google App Engine
This is Rietveld 408576698