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

Side by Side Diff: mojo/shell/dynamic_service_loader.cc

Issue 414173004: mojo: fix little bug in DynamicServiceLoader/Runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oopsies Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/shell/dynamic_service_loader_unittest.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 "mojo/shell/dynamic_service_loader.h" 5 #include "mojo/shell/dynamic_service_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 explicit LocalLoader(scoped_ptr<DynamicServiceRunner> runner) 60 explicit LocalLoader(scoped_ptr<DynamicServiceRunner> runner)
61 : Loader(runner.Pass()) { 61 : Loader(runner.Pass()) {
62 } 62 }
63 63
64 virtual void Start(const GURL& url, 64 virtual void Start(const GURL& url,
65 ScopedMessagePipeHandle service_handle, 65 ScopedMessagePipeHandle service_handle,
66 Context* context) OVERRIDE { 66 Context* context) OVERRIDE {
67 base::FilePath path; 67 base::FilePath path;
68 net::FileURLToFilePath(url, &path); 68 net::FileURLToFilePath(url, &path);
69 69
70 // TODO(darin): Check if the given file path exists.
71
72 // Complete asynchronously for consistency with NetworkServiceLoader. 70 // Complete asynchronously for consistency with NetworkServiceLoader.
73 base::MessageLoop::current()->PostTask( 71 base::MessageLoop::current()->PostTask(
74 FROM_HERE, 72 FROM_HERE,
75 base::Bind(&Loader::StartService, 73 base::Bind(&Loader::StartService,
76 base::Unretained(this), 74 base::Unretained(this),
77 path, 75 path,
78 base::Passed(&service_handle), 76 base::Passed(&service_handle),
79 true)); 77 base::PathExists(path)));
80 } 78 }
81 }; 79 };
82 80
83 // For loading services via the network stack. 81 // For loading services via the network stack.
84 class NetworkLoader : public Loader { 82 class NetworkLoader : public Loader {
85 public: 83 public:
86 explicit NetworkLoader(scoped_ptr<DynamicServiceRunner> runner, 84 explicit NetworkLoader(scoped_ptr<DynamicServiceRunner> runner,
87 NetworkService* network_service) 85 NetworkService* network_service)
88 : Loader(runner.Pass()) { 86 : Loader(runner.Pass()) {
89 network_service->CreateURLLoader(Get(&url_loader_)); 87 network_service->CreateURLLoader(Get(&url_loader_));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 176 }
179 177
180 void DynamicServiceLoader::OnServiceError(ServiceManager* manager, 178 void DynamicServiceLoader::OnServiceError(ServiceManager* manager,
181 const GURL& url) { 179 const GURL& url) {
182 // TODO(darin): What should we do about service errors? This implies that 180 // TODO(darin): What should we do about service errors? This implies that
183 // the app closed its handle to the service manager. Maybe we don't care? 181 // the app closed its handle to the service manager. Maybe we don't care?
184 } 182 }
185 183
186 } // namespace shell 184 } // namespace shell
187 } // namespace mojo 185 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/shell/dynamic_service_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698