| 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_BROWSER_BROWSER_H_ | 5 #ifndef MASH_BROWSER_BROWSER_H_ |
| 6 #define MASH_BROWSER_BROWSER_H_ | 6 #define MASH_BROWSER_BROWSER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mash/public/interfaces/launchable.mojom.h" | 11 #include "mash/public/interfaces/launchable.mojom.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 13 #include "services/shell/public/cpp/shell_client.h" | 13 #include "services/shell/public/cpp/service.h" |
| 14 #include "services/tracing/public/cpp/tracing_impl.h" | 14 #include "services/tracing/public/cpp/tracing_impl.h" |
| 15 | 15 |
| 16 namespace navigation { | 16 namespace navigation { |
| 17 class View; | 17 class View; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 class AuraInit; | 21 class AuraInit; |
| 22 class Widget; | 22 class Widget; |
| 23 class WindowManagerConnection; | 23 class WindowManagerConnection; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace mash { | 26 namespace mash { |
| 27 namespace browser { | 27 namespace browser { |
| 28 | 28 |
| 29 class Browser : public shell::ShellClient, | 29 class Browser : public shell::Service, |
| 30 public mojom::Launchable, | 30 public mojom::Launchable, |
| 31 public shell::InterfaceFactory<mojom::Launchable> { | 31 public shell::InterfaceFactory<mojom::Launchable> { |
| 32 public: | 32 public: |
| 33 Browser(); | 33 Browser(); |
| 34 ~Browser() override; | 34 ~Browser() override; |
| 35 | 35 |
| 36 // Start/stop tracking individual browser windows. When we no longer track any | 36 // Start/stop tracking individual browser windows. When we no longer track any |
| 37 // browser windows, the application terminates. The Browser object does not | 37 // browser windows, the application terminates. The Browser object does not |
| 38 // own these widgets. | 38 // own these widgets. |
| 39 void AddWindow(views::Widget* window); | 39 void AddWindow(views::Widget* window); |
| 40 void RemoveWindow(views::Widget* window); | 40 void RemoveWindow(views::Widget* window); |
| 41 | 41 |
| 42 std::unique_ptr<navigation::View> CreateView(); | 42 std::unique_ptr<navigation::View> CreateView(); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 // shell::ShellClient: | 45 // shell::Service: |
| 46 void Initialize(shell::Connector* connector, | 46 void OnStart(shell::Connector* connector, |
| 47 const shell::Identity& identity, | 47 const shell::Identity& identity, |
| 48 uint32_t id) override; | 48 uint32_t id) override; |
| 49 bool AcceptConnection(shell::Connection* connection) override; | 49 bool OnConnect(shell::Connection* connection) override; |
| 50 | 50 |
| 51 // mojom::Launchable: | 51 // mojom::Launchable: |
| 52 void Launch(uint32_t what, mojom::LaunchMode how) override; | 52 void Launch(uint32_t what, mojom::LaunchMode how) override; |
| 53 | 53 |
| 54 // shell::InterfaceFactory<mojom::Launchable>: | 54 // shell::InterfaceFactory<mojom::Launchable>: |
| 55 void Create(shell::Connection* connection, | 55 void Create(shell::Connection* connection, |
| 56 mojom::LaunchableRequest request) override; | 56 mojom::LaunchableRequest request) override; |
| 57 | 57 |
| 58 shell::Connector* connector_ = nullptr; | 58 shell::Connector* connector_ = nullptr; |
| 59 mojo::BindingSet<mojom::Launchable> bindings_; | 59 mojo::BindingSet<mojom::Launchable> bindings_; |
| 60 std::vector<views::Widget*> windows_; | 60 std::vector<views::Widget*> windows_; |
| 61 | 61 |
| 62 mojo::TracingImpl tracing_; | 62 mojo::TracingImpl tracing_; |
| 63 std::unique_ptr<views::AuraInit> aura_init_; | 63 std::unique_ptr<views::AuraInit> aura_init_; |
| 64 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 64 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(Browser); | 66 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace browser | 69 } // namespace browser |
| 70 } // namespace mash | 70 } // namespace mash |
| 71 | 71 |
| 72 #endif // MASH_BROWSER_BROWSER_H_ | 72 #endif // MASH_BROWSER_BROWSER_H_ |
| OLD | NEW |