| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_INIT_INIT_H_ | 5 #ifndef MASH_INIT_INIT_H_ |
| 6 #define MASH_INIT_INIT_H_ | 6 #define MASH_INIT_INIT_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 "components/mus/public/interfaces/user_access_manager.mojom.h" | 13 #include "mash/init/public/interfaces/init.mojom.h" |
| 14 #include "mash/init/public/interfaces/login.mojom.h" | |
| 15 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
| 16 #include "mojo/shell/public/cpp/connector.h" | 15 #include "mojo/shell/public/cpp/connector.h" |
| 17 #include "mojo/shell/public/cpp/shell_client.h" | 16 #include "mojo/shell/public/cpp/shell_client.h" |
| 18 | 17 |
| 19 namespace mojo { | 18 namespace mojo { |
| 20 class Connection; | 19 class Connection; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace mash { | 22 namespace mash { |
| 24 namespace init{ | 23 namespace init { |
| 25 | 24 |
| 26 class Init : public mojo::ShellClient, | 25 class Init : public mojo::ShellClient, |
| 27 public mojom::Login, | 26 public mojo::InterfaceFactory<mojom::Init>, |
| 28 public mojo::InterfaceFactory<mojom::Login> { | 27 public mojom::Init { |
| 29 public: | 28 public: |
| 30 Init(); | 29 Init(); |
| 31 ~Init() override; | 30 ~Init() override; |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 // mojo::ShellClient: | 33 // mojo::ShellClient: |
| 35 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, | 34 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, |
| 36 uint32_t id) override; | 35 uint32_t id) override; |
| 37 bool AcceptConnection(mojo::Connection* connection) override; | |
| 38 | |
| 39 // mojom::Login: | |
| 40 void LoginAs(const mojo::String& user_id) override; | |
| 41 void Logout() override; | |
| 42 void SwitchUser() override; | |
| 43 | 36 |
| 44 // mojo::InterfaceFactory<mojom::Login>: | 37 // mojo::InterfaceFactory<mojom::Login>: |
| 45 void Create(mojo::Connection* connection, | 38 void Create(mojo::Connection* connection, |
| 46 mojom::LoginRequest request) override; | 39 mojom::InitRequest request) override; |
| 47 | 40 |
| 48 void StartWindowManager(); | 41 // mojom::Init: |
| 42 void StartService(const mojo::String& name, |
| 43 const mojo::String& user_id) override; |
| 44 void StopServicesForUser(const mojo::String& user_id) override; |
| 45 |
| 49 void StartLogin(); | 46 void StartLogin(); |
| 50 | 47 |
| 51 // Starts the application at |url|, running |restart_callback| if the | |
| 52 // connection to the application is closed. | |
| 53 void StartRestartableService(mojo::Connector::ConnectParams* params, | |
| 54 const base::Closure& restart_callback); | |
| 55 | |
| 56 mojo::Connector* connector_; | 48 mojo::Connector* connector_; |
| 57 std::map<std::string, scoped_ptr<mojo::Connection>> connections_; | 49 scoped_ptr<mojo::Connection> login_connection_; |
| 58 mojo::BindingSet<mojom::Login> login_bindings_; | 50 mojo::BindingSet<mojom::Init> init_bindings_; |
| 59 scoped_ptr<mojo::Connection> mus_connection_; | 51 std::map<std::string, scoped_ptr<mojo::Connection>> user_services_; |
| 60 mus::mojom::UserAccessManagerPtr user_access_manager_; | |
| 61 const std::string login_user_id_; | 52 const std::string login_user_id_; |
| 62 | 53 |
| 63 DISALLOW_COPY_AND_ASSIGN(Init); | 54 DISALLOW_COPY_AND_ASSIGN(Init); |
| 64 }; | 55 }; |
| 65 | 56 |
| 66 } // namespace init | 57 } // namespace init |
| 67 } // namespace mash | 58 } // namespace mash |
| 68 | 59 |
| 69 #endif // MASH_INIT_INIT_H_ | 60 #endif // MASH_INIT_INIT_H_ |
| OLD | NEW |