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 UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
| 6 #define UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 6 #define UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "services/service_manager/public/cpp/connector.h" | 11 #include "services/service_manager/public/cpp/connector.h" |
| 12 #include "ui/aura/aura_export.h" | 12 #include "ui/aura/aura_export.h" |
| 13 #include "ui/aura/window_tree_host_platform.h" | 13 #include "ui/aura/window_tree_host_platform.h" |
| 14 #include "ui/gfx/geometry/vector2d.h" | |
| 14 | 15 |
| 15 class SkBitmap; | 16 class SkBitmap; |
| 16 | 17 |
| 18 namespace display { | |
| 19 class Display; | |
| 20 } | |
| 21 | |
| 17 namespace service_manager { | 22 namespace service_manager { |
| 18 class Connector; | 23 class Connector; |
| 19 } | 24 } |
| 20 | 25 |
| 21 namespace aura { | 26 namespace aura { |
| 22 | 27 |
| 23 class InputMethodMus; | 28 class InputMethodMus; |
| 24 class WindowPortMus; | 29 class WindowPortMus; |
| 30 class WindowTreeHostMusDelegate; | |
| 31 | |
| 32 enum class RootWindowType; | |
| 25 | 33 |
| 26 // WindowTreeHostMus is configured in two distinct modes: | 34 // WindowTreeHostMus is configured in two distinct modes: |
| 27 // . with a content window. In this case the content window is added as a child | 35 // . with a content window. In this case the content window is added as a child |
| 28 // of the Window created by this class. Any changes to the size of the content | 36 // of the Window created by this class. Any changes to the size of the content |
| 29 // window is propagated to its parent. Additionally once the content window is | 37 // window is propagated to its parent. Additionally once the content window is |
| 30 // destroyed the WindowTreeHostMus is destroyed. | 38 // destroyed the WindowTreeHostMus is destroyed. |
| 31 // . without a content window. | 39 // . without a content window. |
| 32 // | 40 // |
| 33 // If a content window is supplied WindowTreeHostMus deletes itself when the | 41 // If a content window is supplied WindowTreeHostMus deletes itself when the |
| 34 // content window is destroyed. If no content window is supplied it is assumed | 42 // content window is destroyed. If no content window is supplied it is assumed |
| 35 // the WindowTreeHostMus is explicitly deleted. | 43 // the WindowTreeHostMus is explicitly deleted. |
| 36 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { | 44 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { |
| 37 public: | 45 public: |
| 38 explicit WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port, | 46 explicit WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port, |
|
sadrul
2016/10/27 20:26:17
No explicit
sky
2016/10/27 22:15:04
Done.
| |
| 47 WindowTreeHostMusDelegate* delegate, | |
| 48 RootWindowType root_window_type, | |
| 49 int64_t display_id, | |
| 39 Window* content_window = nullptr); | 50 Window* content_window = nullptr); |
| 40 ~WindowTreeHostMus() override; | 51 ~WindowTreeHostMus() override; |
| 41 | 52 |
| 42 void CreateInputMethod(WindowPortMus* window_port_mus); | 53 void SetBoundsFromServer(const gfx::Rect& bounds); |
|
sadrul
2016/10/27 20:26:17
In dip or physical pixels?
sky
2016/10/27 22:15:04
I commented it's in dips, but I could be wrong as
| |
| 43 | 54 |
| 44 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { | 55 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { |
| 45 return aura::WindowTreeHostPlatform::SendEventToProcessor(event); | 56 return aura::WindowTreeHostPlatform::SendEventToProcessor(event); |
| 46 } | 57 } |
| 47 | 58 |
| 48 Window* content_window() { return content_window_; } | 59 Window* content_window() { return content_window_; } |
| 49 | 60 |
| 50 InputMethodMus* input_method() { return input_method_.get(); } | 61 InputMethodMus* input_method() { return input_method_.get(); } |
| 51 | 62 |
| 63 // Offset of the bounds from its parent. The Window (and content window if | |
| 64 // present) always has an origin of 0x0 locally. This offset gives the offset | |
| 65 // of the window in its parent. | |
| 66 void set_origin_offset(const gfx::Vector2d& offset) { | |
| 67 origin_offset_ = offset; | |
| 68 } | |
| 69 const gfx::Vector2d& origin_offset() const { return origin_offset_; } | |
| 70 | |
| 71 RootWindowType root_window_type() const { return root_window_type_; } | |
| 72 | |
| 73 void set_display_id(int64_t id) { display_id_ = id; } | |
| 74 display::Display GetDisplay() const; | |
| 75 | |
| 52 private: | 76 private: |
| 53 class ContentWindowObserver; | 77 class ContentWindowObserver; |
| 54 | 78 |
| 79 Window* GetWindowWithServerWindow(); | |
| 80 | |
| 55 // Called when various things happen to the content window. | 81 // Called when various things happen to the content window. |
| 56 void ContentWindowDestroyed(); | 82 void ContentWindowDestroyed(); |
| 57 void ContentWindowResized(); | |
| 58 void ContentWindowVisibilityChanging(bool visible); | |
| 59 | 83 |
| 60 // aura::WindowTreeHostPlatform: | 84 // aura::WindowTreeHostPlatform: |
| 85 void ShowImpl() override; | |
| 86 void HideImpl() override; | |
| 87 void SetBounds(const gfx::Rect& bounds) override; | |
| 88 gfx::Rect GetBounds() const override; | |
| 89 gfx::Point GetLocationOnNativeScreen() const override; | |
| 61 void DispatchEvent(ui::Event* event) override; | 90 void DispatchEvent(ui::Event* event) override; |
| 62 void OnClosed() override; | 91 void OnClosed() override; |
| 63 void OnActivationChanged(bool active) override; | 92 void OnActivationChanged(bool active) override; |
| 64 void OnCloseRequest() override; | 93 void OnCloseRequest() override; |
| 65 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; | 94 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; |
| 66 | 95 |
| 96 int64_t display_id_; | |
| 97 const RootWindowType root_window_type_; | |
| 98 | |
| 99 WindowTreeHostMusDelegate* delegate_; | |
| 100 | |
| 101 bool in_set_bounds_from_server_ = false; | |
| 102 | |
| 103 gfx::Vector2d origin_offset_; | |
| 104 | |
| 67 // May be null, see class description. | 105 // May be null, see class description. |
| 68 Window* content_window_; | 106 Window* content_window_; |
| 69 | 107 |
| 70 std::unique_ptr<ContentWindowObserver> content_window_observer_; | 108 std::unique_ptr<ContentWindowObserver> content_window_observer_; |
| 71 std::unique_ptr<InputMethodMus> input_method_; | 109 std::unique_ptr<InputMethodMus> input_method_; |
| 72 | 110 |
| 73 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); | 111 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); |
| 74 }; | 112 }; |
| 75 | 113 |
| 76 } // namespace aura | 114 } // namespace aura |
| 77 | 115 |
| 78 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 116 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
| OLD | NEW |