Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: ui/aura/mus/window_tree_host_mus.h

Issue 2456623002: Fixes to WindowTreeHostMus (Closed)
Patch Set: merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | ui/aura/mus/window_tree_host_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port,
39 Window* content_window = nullptr); 47 WindowTreeHostMusDelegate* delegate,
48 RootWindowType root_window_type,
49 int64_t display_id,
50 Window* content_window = nullptr);
40 ~WindowTreeHostMus() override; 51 ~WindowTreeHostMus() override;
41 52
42 void CreateInputMethod(WindowPortMus* window_port_mus); 53 // Sets the bounds in dips.
54 void SetBoundsFromServer(const gfx::Rect& bounds);
43 55
44 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { 56 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) {
45 return aura::WindowTreeHostPlatform::SendEventToProcessor(event); 57 return aura::WindowTreeHostPlatform::SendEventToProcessor(event);
46 } 58 }
47 59
48 Window* content_window() { return content_window_; } 60 Window* content_window() { return content_window_; }
49 61
50 InputMethodMus* input_method() { return input_method_.get(); } 62 InputMethodMus* input_method() { return input_method_.get(); }
51 63
64 // Offset of the bounds from its parent. The Window (and content window if
65 // present) always has an origin of 0x0 locally. This offset gives the offset
66 // of the window in its parent.
67 void set_origin_offset(const gfx::Vector2d& offset) {
68 origin_offset_ = offset;
69 }
70 const gfx::Vector2d& origin_offset() const { return origin_offset_; }
71
72 RootWindowType root_window_type() const { return root_window_type_; }
73
74 void set_display_id(int64_t id) { display_id_ = id; }
75 display::Display GetDisplay() const;
76
52 private: 77 private:
53 class ContentWindowObserver; 78 class ContentWindowObserver;
54 79
80 Window* GetWindowWithServerWindow();
81
55 // Called when various things happen to the content window. 82 // Called when various things happen to the content window.
56 void ContentWindowDestroyed(); 83 void ContentWindowDestroyed();
57 void ContentWindowResized();
58 void ContentWindowVisibilityChanging(bool visible);
59 84
60 // aura::WindowTreeHostPlatform: 85 // aura::WindowTreeHostPlatform:
86 void ShowImpl() override;
87 void HideImpl() override;
88 void SetBounds(const gfx::Rect& bounds) override;
89 gfx::Rect GetBounds() const override;
90 gfx::Point GetLocationOnNativeScreen() const override;
61 void DispatchEvent(ui::Event* event) override; 91 void DispatchEvent(ui::Event* event) override;
62 void OnClosed() override; 92 void OnClosed() override;
63 void OnActivationChanged(bool active) override; 93 void OnActivationChanged(bool active) override;
64 void OnCloseRequest() override; 94 void OnCloseRequest() override;
65 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; 95 gfx::ICCProfile GetICCProfileForCurrentDisplay() override;
66 96
97 int64_t display_id_;
98 const RootWindowType root_window_type_;
99
100 WindowTreeHostMusDelegate* delegate_;
101
102 bool in_set_bounds_from_server_ = false;
103
104 gfx::Vector2d origin_offset_;
105
67 // May be null, see class description. 106 // May be null, see class description.
68 Window* content_window_; 107 Window* content_window_;
69 108
70 std::unique_ptr<ContentWindowObserver> content_window_observer_; 109 std::unique_ptr<ContentWindowObserver> content_window_observer_;
71 std::unique_ptr<InputMethodMus> input_method_; 110 std::unique_ptr<InputMethodMus> input_method_;
72 111
73 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); 112 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus);
74 }; 113 };
75 114
76 } // namespace aura 115 } // namespace aura
77 116
78 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ 117 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | ui/aura/mus/window_tree_host_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698