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 MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/logging.h" | |
10 #include "mojo/public/cpp/bindings/binding.h" | |
11 #include "mojo/public/cpp/bindings/error_handler.h" | |
12 #include "mojo/services/public/cpp/view_manager/types.h" | |
13 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" | |
14 | |
15 namespace mojo { | |
16 | |
17 class WindowManagerApp; | |
18 | |
19 class WindowManagerImpl : public WindowManager, public ErrorHandler { | |
20 public: | |
21 // See description above |from_vm_| for details on |from_vm|. | |
22 // WindowManagerImpl deletes itself on connection errors. WindowManagerApp | |
23 // also deletes WindowManagerImpl in its destructor. | |
24 WindowManagerImpl(WindowManagerApp* window_manager, bool from_vm); | |
25 ~WindowManagerImpl() override; | |
26 | |
27 void Bind(ScopedMessagePipeHandle window_manager_pipe); | |
28 | |
29 void NotifyViewFocused(Id new_focused_id, Id old_focused_id); | |
30 void NotifyWindowActivated(Id new_active_id, Id old_active_id); | |
31 | |
32 private: | |
33 WindowManagerClient* client() { | |
34 DCHECK(from_vm_); | |
35 return binding_.client(); | |
36 } | |
37 | |
38 // WindowManager: | |
39 void Embed(const String& url, | |
40 InterfaceRequest<ServiceProvider> service_provider) override; | |
41 void SetCapture(uint32_t view_id, | |
42 const Callback<void(bool)>& callback) override; | |
43 void FocusWindow(uint32_t view_id, | |
44 const Callback<void(bool)>& callback) override; | |
45 void ActivateWindow(uint32_t view_id, | |
46 const Callback<void(bool)>& callback) override; | |
47 | |
48 // ErrorHandler: | |
49 void OnConnectionError() override; | |
50 | |
51 WindowManagerApp* window_manager_; | |
52 | |
53 // Whether this connection originated from the ViewManager. Connections that | |
54 // originate from the view manager are expected to have clients. Connections | |
55 // that don't originate from the view manager do not have clients. | |
56 const bool from_vm_; | |
57 | |
58 Binding<WindowManager> binding_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | |
61 }; | |
62 | |
63 } // namespace mojo | |
64 | |
65 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_ | |
OLD | NEW |