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

Side by Side Diff: components/filesystem/file_system_app.cc

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 years, 8 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 | « components/filesystem/file_system_app.h ('k') | components/font_service/font_service_app.h » ('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 2015 The Chromium Authors. All rights reserved. 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 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 "components/filesystem/file_system_app.h" 5 #include "components/filesystem/file_system_app.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 21 matching lines...) Expand all
32 #endif 32 #endif
33 33
34 namespace filesystem { 34 namespace filesystem {
35 35
36 namespace { 36 namespace {
37 37
38 const char kUserDataDir[] = "user-data-dir"; 38 const char kUserDataDir[] = "user-data-dir";
39 39
40 } // namespace filesystem 40 } // namespace filesystem
41 41
42 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {} 42 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {
43 registry_.AddInterface<mojom::FileSystem>(this);
44 }
43 45
44 FileSystemApp::~FileSystemApp() {} 46 FileSystemApp::~FileSystemApp() {}
45 47
46 void FileSystemApp::OnStart() { 48 void FileSystemApp::OnStart() {
47 tracing_.Initialize(context()->connector(), context()->identity().name()); 49 tracing_.Initialize(context()->connector(), context()->identity().name());
48 } 50 }
49 51
50 bool FileSystemApp::OnConnect(const service_manager::ServiceInfo& remote_info, 52 void FileSystemApp::OnBindInterface(
51 service_manager::InterfaceRegistry* registry) { 53 const service_manager::ServiceInfo& source_info,
52 registry->AddInterface<mojom::FileSystem>(this); 54 const std::string& interface_name,
53 return true; 55 mojo::ScopedMessagePipeHandle interface_pipe) {
56 registry_.BindInterface(source_info.identity, interface_name,
57 std::move(interface_pipe));
54 } 58 }
55 59
56 // |InterfaceFactory<Files>| implementation: 60 // |InterfaceFactory<Files>| implementation:
57 void FileSystemApp::Create(const service_manager::Identity& remote_identity, 61 void FileSystemApp::Create(const service_manager::Identity& remote_identity,
58 mojom::FileSystemRequest request) { 62 mojom::FileSystemRequest request) {
59 mojo::MakeStrongBinding(base::MakeUnique<FileSystemImpl>( 63 mojo::MakeStrongBinding(base::MakeUnique<FileSystemImpl>(
60 remote_identity, GetUserDataDir(), lock_table_), 64 remote_identity, GetUserDataDir(), lock_table_),
61 std::move(request)); 65 std::move(request));
62 } 66 }
63 67
(...skipping 22 matching lines...) Expand all
86 path = path.Append(FILE_PATH_LITERAL("filesystem")); 90 path = path.Append(FILE_PATH_LITERAL("filesystem"));
87 } 91 }
88 92
89 if (!base::PathExists(path)) 93 if (!base::PathExists(path))
90 base::CreateDirectory(path); 94 base::CreateDirectory(path);
91 95
92 return path; 96 return path;
93 } 97 }
94 98
95 } // namespace filesystem 99 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/file_system_app.h ('k') | components/font_service/font_service_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698