Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_WM_WINDOW_MANAGER_IMPL_H_ | 5 #ifndef MASH_WM_WINDOW_MANAGER_IMPL_H_ |
| 6 #define MASH_WM_WINDOW_MANAGER_IMPL_H_ | 6 #define MASH_WM_WINDOW_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/mus/common/types.h" | 11 #include "components/mus/common/types.h" |
| 12 #include "components/mus/public/cpp/window_manager_delegate.h" | 12 #include "components/mus/public/cpp/window_manager_delegate.h" |
| 13 #include "components/mus/public/cpp/window_observer.h" | 13 #include "components/mus/public/cpp/window_observer.h" |
| 14 #include "components/mus/public/interfaces/user_window_controller.mojom.h" | |
| 14 #include "components/mus/public/interfaces/window_manager.mojom.h" | 15 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 15 | 16 |
| 16 namespace mash { | 17 namespace mash { |
| 17 namespace wm { | 18 namespace wm { |
| 18 | 19 |
| 19 class WindowManagerApplication; | 20 class WindowManagerApplication; |
| 20 | 21 |
| 21 using WindowManagerErrorCodeCallback = | 22 using WindowManagerErrorCodeCallback = |
| 22 const mojo::Callback<void(mus::mojom::WindowManagerErrorCode)>; | 23 const mojo::Callback<void(mus::mojom::WindowManagerErrorCode)>; |
| 23 | 24 |
| 24 class WindowManagerImpl : public mus::mojom::WindowManager, | 25 class WindowManagerImpl : public mus::mojom::WindowManager, |
| 26 public mus::mojom::UserWindowController, | |
| 25 public mus::WindowObserver, | 27 public mus::WindowObserver, |
| 26 public mus::WindowManagerDelegate { | 28 public mus::WindowManagerDelegate { |
| 27 public: | 29 public: |
| 28 WindowManagerImpl(); | 30 WindowManagerImpl(); |
| 29 ~WindowManagerImpl() override; | 31 ~WindowManagerImpl() override; |
| 30 | 32 |
| 31 void Initialize(WindowManagerApplication* state); | 33 void Initialize(WindowManagerApplication* state); |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 gfx::Rect CalculateDefaultBounds(mus::Window* window) const; | 36 gfx::Rect CalculateDefaultBounds(mus::Window* window) const; |
| 35 gfx::Rect GetMaximizedWindowBounds() const; | 37 gfx::Rect GetMaximizedWindowBounds() const; |
| 36 | 38 |
| 37 mus::Window* NewTopLevelWindow( | 39 mus::Window* NewTopLevelWindow( |
| 38 std::map<std::string, std::vector<uint8_t>>* properties, | 40 std::map<std::string, std::vector<uint8_t>>* properties, |
| 39 mus::mojom::WindowTreeClientPtr client); | 41 mus::mojom::WindowTreeClientPtr client); |
| 40 | 42 |
| 41 // mus::WindowObserver: | 43 // mus::WindowObserver: |
| 42 void OnTreeChanging(const TreeChangeParams& params) override; | 44 void OnTreeChanging(const TreeChangeParams& params) override; |
| 43 void OnWindowEmbeddedAppDisconnected(mus::Window* window) override; | 45 void OnWindowEmbeddedAppDisconnected(mus::Window* window) override; |
| 44 | 46 |
| 45 // mus::mojom::WindowManager: | 47 // mus::mojom::WindowManager: |
| 46 void OpenWindow(mus::mojom::WindowTreeClientPtr client, | 48 void OpenWindow(mus::mojom::WindowTreeClientPtr client, |
| 47 mojo::Map<mojo::String, mojo::Array<uint8_t>> | 49 mojo::Map<mojo::String, mojo::Array<uint8_t>> |
| 48 transport_properties) override; | 50 transport_properties) override; |
| 49 void GetConfig(const GetConfigCallback& callback) override; | 51 void GetConfig(const GetConfigCallback& callback) override; |
| 50 | 52 |
| 53 // mus::mojom::UserWindowController: | |
| 54 void AddUserWindowObserver( | |
| 55 mus::mojom::UserWindowObserverPtr observer) override; | |
| 56 void FocusUserWindow(uint32_t window_id) override; | |
| 57 | |
| 51 // WindowManagerDelegate: | 58 // WindowManagerDelegate: |
| 52 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override; | 59 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override; |
| 53 bool OnWmSetProperty(mus::Window* window, | 60 bool OnWmSetProperty(mus::Window* window, |
| 54 const std::string& name, | 61 const std::string& name, |
| 55 scoped_ptr<std::vector<uint8_t>>* new_data) override; | 62 scoped_ptr<std::vector<uint8_t>>* new_data) override; |
| 56 mus::Window* OnWmCreateTopLevelWindow( | 63 mus::Window* OnWmCreateTopLevelWindow( |
| 57 std::map<std::string, std::vector<uint8_t>>* properties) override; | 64 std::map<std::string, std::vector<uint8_t>>* properties) override; |
| 58 | 65 |
| 59 WindowManagerApplication* state_; | 66 WindowManagerApplication* state_; |
| 67 mus::mojom::UserWindowObserverPtr user_window_observer_; | |
|
sky
2016/01/13 21:17:17
I suspect this code will become more complex, and
msw
2016/01/13 22:54:56
Done.
| |
| 60 | 68 |
| 61 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | 69 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
| 62 }; | 70 }; |
| 63 | 71 |
| 64 } // namespace wm | 72 } // namespace wm |
| 65 } // namespace mash | 73 } // namespace mash |
| 66 | 74 |
| 67 #endif // MASH_WM_WINDOW_MANAGER_IMPL_H_ | 75 #endif // MASH_WM_WINDOW_MANAGER_IMPL_H_ |
| OLD | NEW |