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