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 EXAMPLES_WM_FLOW_WM_FRAME_CONTROLLER_H_ | |
6 #define EXAMPLES_WM_FLOW_WM_FRAME_CONTROLLER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "examples/wm_flow/wm/window_frame_host.mojom.h" | |
10 #include "mojo/public/cpp/application/interface_factory.h" | |
11 #include "mojo/public/cpp/application/service_provider_impl.h" | |
12 #include "mojo/services/view_manager/cpp/view_observer.h" | |
13 #include "services/window_manager/focus_controller.h" | |
14 #include "ui/gfx/geometry/rect.h" | |
15 | |
16 class GURL; | |
17 | |
18 namespace mojo { | |
19 class NativeWidgetViewManager; | |
20 class View; | |
21 } | |
22 | |
23 namespace window_manager { | |
24 class WindowManagerRoot; | |
25 } | |
26 | |
27 // FrameController encapsulates the window manager's frame additions to a window | |
28 // created by an application. It renders the content of the frame and responds | |
29 // to any events targeted at it. | |
30 class FrameController | |
31 : public examples::WindowFrameHost, | |
32 public mojo::ViewObserver, | |
33 public mojo::InterfaceFactory<examples::WindowFrameHost> { | |
34 public: | |
35 FrameController(const GURL& frame_app_url, | |
36 mojo::View* view, | |
37 mojo::View** app_view, | |
38 window_manager::WindowManagerRoot* window_manager_root); | |
39 ~FrameController() override; | |
40 | |
41 // mojo::InterfaceFactory<examples::WindowFrameHost> implementation. | |
42 void Create( | |
43 mojo::ApplicationConnection* connection, | |
44 mojo::InterfaceRequest<examples::WindowFrameHost> request) override; | |
45 | |
46 // examples::WindowFrameHost | |
47 void CloseWindow() override; | |
48 void ToggleMaximize() override; | |
49 void ActivateWindow() override; | |
50 void SetCapture(bool frame_has_capture) override; | |
51 | |
52 private: | |
53 void OnViewDestroyed(mojo::View* view) override; | |
54 void OnViewBoundsChanged(mojo::View* view, | |
55 const mojo::Rect& old_bounds, | |
56 const mojo::Rect& new_bounds) override; | |
57 | |
58 mojo::View* view_; | |
59 mojo::View* app_view_; | |
60 bool maximized_; | |
61 gfx::Rect restored_bounds_; | |
62 window_manager::WindowManagerRoot* window_manager_root_; | |
63 mojo::ServiceProviderImpl viewer_services_impl_; | |
64 | |
65 mojo::Binding<examples::WindowFrameHost> binding_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(FrameController); | |
68 }; | |
69 | |
70 #endif // EXAMPLES_WM_FLOW_WM_FRAME_CONTROLLER_H_ | |
OLD | NEW |