OLD | NEW |
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 MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | 5 #ifndef MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ |
6 #define MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | 6 #define MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
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/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "mash/shell/public/interfaces/shell.mojom.h" |
| 14 #include "mojo/common/weak_binding_set.h" |
13 #include "mojo/shell/public/cpp/application_delegate.h" | 15 #include "mojo/shell/public/cpp/application_delegate.h" |
| 16 #include "mojo/shell/public/cpp/interface_factory.h" |
14 | 17 |
15 namespace mojo { | 18 namespace mojo { |
16 class ApplicationConnection; | 19 class ApplicationConnection; |
17 } | 20 } |
18 | 21 |
19 namespace mash { | 22 namespace mash { |
20 namespace shell { | 23 namespace shell { |
21 | 24 |
22 class ShellApplicationDelegate : public mojo::ApplicationDelegate { | 25 class ShellApplicationDelegate |
| 26 : public mojo::ApplicationDelegate, |
| 27 public mash::shell::mojom::Shell, |
| 28 public mojo::InterfaceFactory<mash::shell::mojom::Shell> { |
23 public: | 29 public: |
24 ShellApplicationDelegate(); | 30 ShellApplicationDelegate(); |
25 ~ShellApplicationDelegate() override; | 31 ~ShellApplicationDelegate() override; |
26 | 32 |
27 private: | 33 private: |
28 // mojo::ApplicationDelegate: | 34 // mojo::ApplicationDelegate: |
29 void Initialize(mojo::ApplicationImpl* app) override; | 35 void Initialize(mojo::ApplicationImpl* app) override; |
30 bool ConfigureIncomingConnection( | 36 bool ConfigureIncomingConnection( |
31 mojo::ApplicationConnection* connection) override; | 37 mojo::ApplicationConnection* connection) override; |
32 | 38 |
| 39 // mash::shell::mojom::Shell: |
| 40 void LockScreen() override; |
| 41 void UnlockScreen() override; |
| 42 |
| 43 // mojo::InterfaceFactory<mash::shell::mojom::Shell>: |
| 44 void Create(mojo::ApplicationConnection* connection, |
| 45 mojo::InterfaceRequest<mash::shell::mojom::Shell> r) override; |
| 46 |
33 void StartWindowManager(); | 47 void StartWindowManager(); |
34 void StartWallpaper(); | 48 void StartWallpaper(); |
35 void StartShelf(); | 49 void StartShelf(); |
36 void StartBrowserDriver(); | 50 void StartBrowserDriver(); |
37 void StartQuickLaunch(); | 51 void StartQuickLaunch(); |
38 | 52 |
| 53 void StartScreenlock(); |
| 54 void StopScreenlock(); |
| 55 |
39 // Starts the application at |url|, running |restart_callback| if the | 56 // Starts the application at |url|, running |restart_callback| if the |
40 // connection to the application is closed. | 57 // connection to the application is closed. |
41 void StartRestartableService(const std::string& url, | 58 void StartRestartableService(const std::string& url, |
42 const base::Closure& restart_callback); | 59 const base::Closure& restart_callback); |
43 | 60 |
44 mojo::ApplicationImpl* app_; | 61 mojo::ApplicationImpl* app_; |
45 std::map<std::string, scoped_ptr<mojo::ApplicationConnection>> connections_; | 62 std::map<std::string, scoped_ptr<mojo::ApplicationConnection>> connections_; |
| 63 mojo::WeakBindingSet<mash::shell::mojom::Shell> bindings_; |
46 | 64 |
47 DISALLOW_COPY_AND_ASSIGN(ShellApplicationDelegate); | 65 DISALLOW_COPY_AND_ASSIGN(ShellApplicationDelegate); |
48 }; | 66 }; |
49 | 67 |
50 } // namespace shell | 68 } // namespace shell |
51 } // namespace mash | 69 } // namespace mash |
52 | 70 |
53 #endif // MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | 71 #endif // MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ |
OLD | NEW |