OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | |
6 #define MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/macros.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "mash/shell/public/interfaces/shell.mojom.h" | |
14 #include "mojo/public/cpp/bindings/binding_set.h" | |
15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
16 #include "mojo/shell/public/cpp/interface_factory.h" | |
17 #include "mojo/shell/public/cpp/shell_client.h" | |
18 | |
19 namespace mojo { | |
20 class Connection; | |
21 } | |
22 | |
23 namespace mash { | |
24 namespace shell { | |
25 | |
26 class ShellApplicationDelegate | |
27 : public mojo::ShellClient, | |
28 public mash::shell::mojom::Shell, | |
29 public mojo::InterfaceFactory<mash::shell::mojom::Shell> { | |
30 public: | |
31 ShellApplicationDelegate(); | |
32 ~ShellApplicationDelegate() override; | |
33 | |
34 private: | |
35 // mojo::ShellClient: | |
36 void Initialize(mojo::Connector* connector, | |
37 const mojo::Identity& identity, | |
38 uint32_t id) override; | |
39 bool AcceptConnection(mojo::Connection* connection) override; | |
40 | |
41 // mash::shell::mojom::Shell: | |
42 void Logout() override; | |
43 void SwitchUser() override; | |
44 void AddScreenlockStateListener( | |
45 mojom::ScreenlockStateListenerPtr listener) override; | |
46 void LockScreen() override; | |
47 void UnlockScreen() override; | |
48 | |
49 // mojo::InterfaceFactory<mash::shell::mojom::Shell>: | |
50 void Create(mojo::Connection* connection, | |
51 mojo::InterfaceRequest<mash::shell::mojom::Shell> r) override; | |
52 | |
53 void StartWindowManager(); | |
54 void StartSystemUI(); | |
55 void StartBrowserDriver(); | |
56 void StartQuickLaunch(); | |
57 | |
58 void StartScreenlock(); | |
59 void StopScreenlock(); | |
60 | |
61 // Starts the application at |url|, running |restart_callback| if the | |
62 // connection to the application is closed. | |
63 void StartRestartableService(const std::string& url, | |
64 const base::Closure& restart_callback); | |
65 | |
66 mojo::Connector* connector_; | |
67 std::map<std::string, scoped_ptr<mojo::Connection>> connections_; | |
68 bool screen_locked_; | |
69 mojo::BindingSet<mash::shell::mojom::Shell> bindings_; | |
70 mojo::InterfacePtrSet<mojom::ScreenlockStateListener> screenlock_listeners_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(ShellApplicationDelegate); | |
73 }; | |
74 | |
75 } // namespace shell | |
76 } // namespace mash | |
77 | |
78 #endif // MASH_SHELL_SHELL_APPLICATION_DELEGATE_H_ | |
OLD | NEW |