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

Side by Side Diff: mojo/services/network/network_service.cc

Issue 858093002: Update the network service from the Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « mojo/services/network/network_context.cc ('k') | mojo/services/network/network_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/at_exit.h"
5 #include "base/base_paths.h" 6 #include "base/base_paths.h"
7 #include "base/command_line.h"
6 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
7 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
8 #include "base/path_service.h" 10 #include "base/path_service.h"
9 #include "mojo/application/application_runner_chromium.h" 11 #include "mojo/application/application_runner_chromium.h"
10 #include "mojo/public/c/system/main.h" 12 #include "mojo/public/c/system/main.h"
11 #include "mojo/public/cpp/application/application_connection.h" 13 #include "mojo/public/cpp/application/application_connection.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 14 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/interface_factory.h" 15 #include "mojo/public/cpp/application/interface_factory.h"
16 #include "mojo/public/cpp/bindings/interface_ptr.h"
14 #include "mojo/services/network/network_context.h" 17 #include "mojo/services/network/network_context.h"
15 #include "mojo/services/network/network_service_impl.h" 18 #include "mojo/services/network/network_service_impl.h"
16 19
17 class NetworkServiceDelegate 20 class NetworkServiceDelegate
18 : public mojo::ApplicationDelegate, 21 : public mojo::ApplicationDelegate,
19 public mojo::InterfaceFactory<mojo::NetworkService> { 22 public mojo::InterfaceFactory<mojo::NetworkService> {
20 private: 23 private:
21 void Initialize(mojo::ApplicationImpl* app) override { 24 void Initialize(mojo::ApplicationImpl* app) override {
22 base::FilePath base_path; 25 base::FilePath base_path;
23 CHECK(PathService::Get(base::DIR_TEMP, &base_path)); 26 CHECK(PathService::Get(base::DIR_TEMP, &base_path));
24 base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); 27 base_path = base_path.Append(FILE_PATH_LITERAL("network_service"));
25 context_.reset(new mojo::NetworkContext(base_path)); 28 context_.reset(new mojo::NetworkContext(base_path));
26 } 29 }
27 30
28 // mojo::ApplicationDelegate implementation. 31 // mojo::ApplicationDelegate implementation.
29 bool ConfigureIncomingConnection( 32 bool ConfigureIncomingConnection(
30 mojo::ApplicationConnection* connection) override { 33 mojo::ApplicationConnection* connection) override {
31 DCHECK(context_); 34 DCHECK(context_);
32 connection->AddService(this); 35 connection->AddService(this);
33 return true; 36 return true;
34 } 37 }
35 38
36 // mojo::InterfaceFactory<mojo::NetworkService> implementation. 39 // mojo::InterfaceFactory<mojo::NetworkService> implementation.
37 void Create(mojo::ApplicationConnection* connection, 40 void Create(mojo::ApplicationConnection* connection,
38 mojo::InterfaceRequest<mojo::NetworkService> request) override { 41 mojo::InterfaceRequest<mojo::NetworkService> request) override {
39 mojo::BindToRequest( 42 mojo::BindToRequest(
40 new mojo::NetworkServiceImpl(connection, context_.get()), &request); 43 new mojo::NetworkServiceImpl(connection, context_.get()), &request);
41 } 44 }
42 45
46 private:
43 scoped_ptr<mojo::NetworkContext> context_; 47 scoped_ptr<mojo::NetworkContext> context_;
44 }; 48 };
45 49
46 MojoResult MojoMain(MojoHandle shell_handle) { 50 MojoResult MojoMain(MojoHandle shell_handle) {
47 mojo::ApplicationRunnerChromium runner(new NetworkServiceDelegate); 51 mojo::ApplicationRunnerChromium runner(new NetworkServiceDelegate);
48 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); 52 runner.set_message_loop_type(base::MessageLoop::TYPE_IO);
49 return runner.Run(shell_handle); 53 return runner.Run(shell_handle);
50 } 54 }
OLDNEW
« no previous file with comments | « mojo/services/network/network_context.cc ('k') | mojo/services/network/network_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698