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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/net/mojo_app_proxy_resolver_factory.h"
6
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9 #include "chrome/common/application_urls.h"
10 #include "chrome/grit/generated_resources.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/mojo_app_connection.h"
13 #include "url/gurl.h"
14
15 // static
16 MojoAppProxyResolverFactory* MojoAppProxyResolverFactory::GetInstance() {
17 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
18 return Singleton<MojoAppProxyResolverFactory,
19 LeakySingletonTraits<MojoAppProxyResolverFactory>>::get();
20 }
21
22 MojoAppProxyResolverFactory::MojoAppProxyResolverFactory() {
23 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
24 }
25
26 MojoAppProxyResolverFactory::~MojoAppProxyResolverFactory() {
27 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
28 }
29
30 void MojoAppProxyResolverFactory::CreateResolver(
31 const mojo::String& pac_script,
32 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
33 net::interfaces::HostResolverPtr host_resolver,
34 net::interfaces::ProxyResolverFactoryRequestClientPtr client) {
35 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
36 if (!resolver_factory_) {
37 content::MojoAppConnection proxy_app(
38 (GURL(application_urls::kProxyResolver)));
39 proxy_app.ConnectToService(&resolver_factory_);
40 }
41 resolver_factory_->CreateResolver(pac_script, req.Pass(),
42 host_resolver.Pass(), client.Pass());
43 }
44
45 void MojoAppProxyResolverFactory::OnConnectionError() {
46 DVLOG(1) << "Disconnection from utility process detected";
47 resolver_factory_.reset();
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698