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

Side by Side Diff: shell/application_manager/application_manager.h

Issue 961053005: More shell cleanup: Move NativeRunner(Factory) to native_runner.h. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 9 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 | « shell/application_manager/BUILD.gn ('k') | shell/application_manager/application_manager.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 SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 5 #ifndef SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/macros.h"
11 #include "base/callback.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
16 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "mojo/public/interfaces/application/application.mojom.h"
17 #include "mojo/public/interfaces/application/service_provider.mojom.h" 16 #include "mojo/public/interfaces/application/service_provider.mojom.h"
18 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 17 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
19 #include "shell/application_manager/application_loader.h" 18 #include "shell/application_manager/application_loader.h"
20 #include "shell/application_manager/fetcher.h" 19 #include "shell/application_manager/native_runner.h"
21 #include "shell/application_manager/shell_impl.h"
22 #include "url/gurl.h" 20 #include "url/gurl.h"
23 21
24 namespace base { 22 namespace base {
25 class FilePath; 23 class FilePath;
26 class SequencedWorkerPool; 24 class SequencedWorkerPool;
27 } 25 }
28 26
29 namespace mojo { 27 namespace mojo {
30 namespace shell { 28 namespace shell {
31 29
32 // ApplicationManager requires implementations of NativeRunner and 30 class Fetcher;
33 // NativeRunnerFactory to run native applications. 31 class ShellImpl;
34 class NativeRunner {
35 public:
36 // Parameter for |Start()| to specify its cleanup behavior.
37 enum CleanupBehavior { DeleteAppPath, DontDeleteAppPath };
38
39 virtual ~NativeRunner() {}
40
41 // Loads the app in the file at |app_path| and runs it on some other
42 // thread/process. If |cleanup_behavior| is |true|, takes ownership of the
43 // file. |app_completed_callback| is posted (to the thread on which |Start()|
44 // was called) after |MojoMain()| completes.
45 // TODO(vtl): |app_path| and |cleanup_behavior| should probably be moved to
46 // the factory's Create(). Rationale: The factory may need information from
47 // the file to decide what kind of NativeRunner to make.
48 virtual void Start(const base::FilePath& app_path,
49 CleanupBehavior cleanup_behavior,
50 InterfaceRequest<Application> application_request,
51 const base::Closure& app_completed_callback) = 0;
52 };
53
54 class NativeRunnerFactory {
55 public:
56 // Options for running the native app. (This will contain, e.g., information
57 // about the sandbox profile, etc.)
58 struct Options {
59 // Constructs with default options.
60 Options() : force_in_process(false) {}
61
62 bool force_in_process;
63 };
64
65 virtual ~NativeRunnerFactory() {}
66 virtual scoped_ptr<NativeRunner> Create(const Options& options) = 0;
67 };
68 32
69 class ApplicationManager { 33 class ApplicationManager {
70 public: 34 public:
71 class Delegate { 35 class Delegate {
72 public: 36 public:
73 virtual ~Delegate(); 37 virtual ~Delegate();
74 // Send when the Application holding the handle on the other end of the 38 // Send when the Application holding the handle on the other end of the
75 // Shell pipe goes away. 39 // Shell pipe goes away.
76 virtual void OnApplicationError(const GURL& url); 40 virtual void OnApplicationError(const GURL& url);
77 virtual GURL ResolveURL(const GURL& url); 41 virtual GURL ResolveURL(const GURL& url);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ScopedVector<NativeRunner> native_runners_; 222 ScopedVector<NativeRunner> native_runners_;
259 bool disable_cache_; 223 bool disable_cache_;
260 224
261 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 225 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
262 }; 226 };
263 227
264 } // namespace shell 228 } // namespace shell
265 } // namespace mojo 229 } // namespace mojo
266 230
267 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 231 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « shell/application_manager/BUILD.gn ('k') | shell/application_manager/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698