OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
6 #define COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/logging.h" | |
10 #include "components/view_manager/public/cpp/types.h" | |
11 #include "components/window_manager/public/interfaces/window_manager.mojom.h" | |
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | |
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" | |
14 | |
15 namespace window_manager { | |
16 | |
17 class WindowManagerApp; | |
18 | |
19 class WindowManagerImpl : public mojo::WindowManager, | |
20 public mojo::ErrorHandler { | |
21 public: | |
22 // See description above |from_vm_| for details on |from_vm|. | |
23 // WindowManagerImpl deletes itself on connection errors. WindowManagerApp | |
24 // also deletes WindowManagerImpl in its destructor. | |
25 WindowManagerImpl(WindowManagerApp* window_manager, bool from_vm); | |
26 ~WindowManagerImpl() override; | |
27 | |
28 void Bind(mojo::ScopedMessagePipeHandle window_manager_pipe); | |
29 | |
30 private: | |
31 // mojo::WindowManager: | |
32 void Embed(const mojo::String& url, | |
33 mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
34 mojo::ServiceProviderPtr exposed_services) override; | |
35 | |
36 // mojo::ErrorHandler: | |
37 void OnConnectionError() override; | |
38 | |
39 WindowManagerApp* window_manager_; | |
40 | |
41 // Whether this connection originated from the ViewManager. Connections that | |
42 // originate from the view manager are expected to have clients. Connections | |
43 // that don't originate from the view manager do not have clients. | |
44 const bool from_vm_; | |
45 | |
46 mojo::Binding<mojo::WindowManager> binding_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | |
49 }; | |
50 | |
51 } // namespace window_manager | |
52 | |
53 #endif // COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
OLD | NEW |