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

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

Issue 323593002: Mojo: Use network service to load non-local Mojo Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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/shell/desktop/mojo_main.cc ('k') | mojo/shell/dynamic_service_loader.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 #ifndef MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_ 5 #ifndef MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_
6 #define MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_ 6 #define MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "mojo/public/cpp/system/core.h" 11 #include "mojo/public/cpp/system/core.h"
12 #include "mojo/service_manager/service_loader.h" 12 #include "mojo/service_manager/service_loader.h"
13 #include "mojo/services/public/interfaces/network/network_service.mojom.h"
13 #include "mojo/shell/dynamic_service_runner.h" 14 #include "mojo/shell/dynamic_service_runner.h"
14 #include "mojo/shell/keep_alive.h" 15 #include "mojo/shell/keep_alive.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace mojo { 18 namespace mojo {
18 namespace shell { 19 namespace shell {
19 20
20 class Context; 21 class Context;
21 class DynamicServiceRunnerFactory; 22 class DynamicServiceRunnerFactory;
22 23
23 // An implementation of ServiceLoader that retrieves a dynamic library 24 // An implementation of ServiceLoader that retrieves a dynamic library
24 // containing the implementation of the service and loads/runs it (via a 25 // containing the implementation of the service and loads/runs it (via a
25 // DynamicServiceRunner). 26 // DynamicServiceRunner).
26 class DynamicServiceLoader : public ServiceLoader { 27 class DynamicServiceLoader : public ServiceLoader {
27 public: 28 public:
28 DynamicServiceLoader(Context* context, 29 DynamicServiceLoader(Context* context,
29 scoped_ptr<DynamicServiceRunnerFactory> runner_factory); 30 scoped_ptr<DynamicServiceRunnerFactory> runner_factory);
30 virtual ~DynamicServiceLoader(); 31 virtual ~DynamicServiceLoader();
31 32
32 // Initiates the dynamic load. If the URL has a mojo: scheme, then the name 33 // ServiceLoader methods:
33 // specified will be modified to the platform's naming scheme. Also, the
34 // value specified to the --origin command line argument will be used as the
35 // host/port.
36 virtual void LoadService(ServiceManager* manager, 34 virtual void LoadService(ServiceManager* manager,
37 const GURL& url, 35 const GURL& url,
38 ScopedMessagePipeHandle service_handle) OVERRIDE; 36 ScopedMessagePipeHandle service_handle) OVERRIDE;
39 virtual void OnServiceError(ServiceManager* manager, const GURL& url) 37 virtual void OnServiceError(ServiceManager* manager, const GURL& url)
40 OVERRIDE; 38 OVERRIDE;
41 39
42 private: 40 private:
43 class LoadContext;
44
45 void AppCompleted(const GURL& url);
46
47 Context* const context_; 41 Context* const context_;
48 scoped_ptr<DynamicServiceRunnerFactory> runner_factory_; 42 scoped_ptr<DynamicServiceRunnerFactory> runner_factory_;
49 43 NetworkServicePtr network_service_;
50 typedef std::map<GURL, LoadContext*> LoadContextMap;
51 LoadContextMap url_to_load_context_;
52 44
53 DISALLOW_COPY_AND_ASSIGN(DynamicServiceLoader); 45 DISALLOW_COPY_AND_ASSIGN(DynamicServiceLoader);
54 }; 46 };
55 47
56 } // namespace shell 48 } // namespace shell
57 } // namespace mojo 49 } // namespace mojo
58 50
59 #endif // MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_ 51 #endif // MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_
OLDNEW
« no previous file with comments | « mojo/shell/desktop/mojo_main.cc ('k') | mojo/shell/dynamic_service_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698