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

Side by Side Diff: content/common/mojo/static_loader.h

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « content/common/mojo/service_registry_impl.cc ('k') | content/common/mojo/static_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 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 #ifndef CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_ 5 #ifndef CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_
6 #define CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_ 6 #define CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "services/shell/loader.h" 13 #include "services/shell/loader.h"
14 14
15 namespace base { 15 namespace base {
16 class SimpleThread; 16 class SimpleThread;
17 } 17 }
18 18
19 namespace mojo { 19 namespace shell {
20 class ShellClient; 20 class ShellClient;
21 } 21 }
22 22
23 namespace content { 23 namespace content {
24 24
25 // An Loader which loads a single type of app from a given 25 // An Loader which loads a single type of app from a given
26 // mojo::ShellClientFactory. A Load() request is fulfilled by creating an 26 // shell::ShellClientFactory. A Load() request is fulfilled by creating an
27 // instance of the app on a new thread. Only one instance of the app will run at 27 // instance of the app on a new thread. Only one instance of the app will run at
28 // a time. Any Load requests received while the app is running will be dropped. 28 // a time. Any Load requests received while the app is running will be dropped.
29 class StaticLoader : public mojo::shell::Loader { 29 class StaticLoader : public shell::Loader {
30 public: 30 public:
31 using ApplicationFactory = 31 using ApplicationFactory =
32 base::Callback<std::unique_ptr<mojo::ShellClient>()>; 32 base::Callback<std::unique_ptr<shell::ShellClient>()>;
33 33
34 // Constructs a static loader for |factory|. 34 // Constructs a static loader for |factory|.
35 explicit StaticLoader(const ApplicationFactory& factory); 35 explicit StaticLoader(const ApplicationFactory& factory);
36 36
37 // Constructs a static loader for |factory| with a closure that will be called 37 // Constructs a static loader for |factory| with a closure that will be called
38 // when the loaded application quits. 38 // when the loaded application quits.
39 StaticLoader(const ApplicationFactory& factory, 39 StaticLoader(const ApplicationFactory& factory,
40 const base::Closure& quit_callback); 40 const base::Closure& quit_callback);
41 41
42 ~StaticLoader() override; 42 ~StaticLoader() override;
43 43
44 // mojo::shell::Loader: 44 // shell::Loader:
45 void Load(const std::string& name, 45 void Load(const std::string& name,
46 mojo::shell::mojom::ShellClientRequest request) override; 46 shell::mojom::ShellClientRequest request) override;
47 47
48 private: 48 private:
49 void StopAppThread(); 49 void StopAppThread();
50 50
51 // The factory used t create new instances of the application delegate. 51 // The factory used t create new instances of the application delegate.
52 ApplicationFactory factory_; 52 ApplicationFactory factory_;
53 53
54 // If not null, this is run when the loaded application quits. 54 // If not null, this is run when the loaded application quits.
55 base::Closure quit_callback_; 55 base::Closure quit_callback_;
56 56
57 // Thread for the application if currently running. 57 // Thread for the application if currently running.
58 std::unique_ptr<base::SimpleThread> thread_; 58 std::unique_ptr<base::SimpleThread> thread_;
59 59
60 base::WeakPtrFactory<StaticLoader> weak_factory_; 60 base::WeakPtrFactory<StaticLoader> weak_factory_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(StaticLoader); 62 DISALLOW_COPY_AND_ASSIGN(StaticLoader);
63 }; 63 };
64 64
65 } // namespace content 65 } // namespace content
66 66
67 #endif // CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_ 67 #endif // CONTENT_COMMON_MOJO_STATIC_APPLICATION_LOADER_H_
OLDNEW
« no previous file with comments | « content/common/mojo/service_registry_impl.cc ('k') | content/common/mojo/static_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698