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

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

Issue 2470963002: Makes it possible for clients to directly create WindowTreeHostMus (Closed)
Patch Set: includes 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
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"
15 14
16 class SkBitmap; 15 class SkBitmap;
17 16
18 namespace display { 17 namespace display {
19 class Display; 18 class Display;
20 } 19 }
21 20
22 namespace service_manager { 21 namespace service_manager {
23 class Connector; 22 class Connector;
24 } 23 }
25 24
26 namespace aura { 25 namespace aura {
27 26
28 class InputMethodMus; 27 class InputMethodMus;
29 class WindowPortMus; 28 class WindowPortMus;
29 class WindowTreeClient;
30 class WindowTreeHostMusDelegate; 30 class WindowTreeHostMusDelegate;
31 31
32 enum class RootWindowType;
33
34 // WindowTreeHostMus is configured in two distinct modes:
35 // . with a content window. In this case the content window is added as a child
36 // of the Window created by this class. Any changes to the size of the content
37 // window is propagated to its parent. Additionally once the content window is
38 // destroyed the WindowTreeHostMus is destroyed.
39 // . without a content window.
40 //
41 // If a content window is supplied WindowTreeHostMus deletes itself when the
42 // content window is destroyed. If no content window is supplied it is assumed
43 // the WindowTreeHostMus is explicitly deleted.
44 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { 32 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform {
45 public: 33 public:
46 WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port, 34 WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port,
47 WindowTreeHostMusDelegate* delegate, 35 WindowTreeHostMusDelegate* delegate,
48 RootWindowType root_window_type, 36 int64_t display_id);
49 int64_t display_id, 37 explicit WindowTreeHostMus(WindowTreeClient* window_tree_client);
sadrul 2016/11/02 16:03:04 Is this used only in tests?
sky 2016/11/02 16:53:23 It will be used in views. Specifically I'm working
50 Window* content_window = nullptr);
51 ~WindowTreeHostMus() override; 38 ~WindowTreeHostMus() override;
52 39
53 // Sets the bounds in dips. 40 // Sets the bounds in dips.
54 void SetBoundsFromServer(const gfx::Rect& bounds); 41 void SetBoundsFromServer(const gfx::Rect& bounds);
55 42
56 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { 43 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) {
57 return aura::WindowTreeHostPlatform::SendEventToProcessor(event); 44 return aura::WindowTreeHostPlatform::SendEventToProcessor(event);
58 } 45 }
59 46
60 Window* content_window() { return content_window_; }
61
62 InputMethodMus* input_method() { return input_method_.get(); } 47 InputMethodMus* input_method() { return input_method_.get(); }
63 48
64 // Offset of the bounds from its parent. The Window (and content window if 49 // Intended only for WindowTreeClient to call.
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; } 50 void set_display_id(int64_t id) { display_id_ = id; }
51 int64_t display_id() const { return display_id_; }
75 display::Display GetDisplay() const; 52 display::Display GetDisplay() const;
76 53
77 private:
78 class ContentWindowObserver;
79
80 Window* GetWindowWithServerWindow();
81
82 // Called when various things happen to the content window.
83 void ContentWindowDestroyed();
84
85 // aura::WindowTreeHostPlatform: 54 // aura::WindowTreeHostPlatform:
86 void ShowImpl() override; 55 void ShowImpl() override;
87 void HideImpl() override; 56 void HideImpl() override;
88 void SetBounds(const gfx::Rect& bounds) override; 57 void SetBounds(const gfx::Rect& bounds) override;
89 gfx::Rect GetBounds() const override;
90 gfx::Point GetLocationOnNativeScreen() const override;
91 void DispatchEvent(ui::Event* event) override; 58 void DispatchEvent(ui::Event* event) override;
92 void OnClosed() override; 59 void OnClosed() override;
93 void OnActivationChanged(bool active) override; 60 void OnActivationChanged(bool active) override;
94 void OnCloseRequest() override; 61 void OnCloseRequest() override;
95 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; 62 gfx::ICCProfile GetICCProfileForCurrentDisplay() override;
96 63
64 private:
97 int64_t display_id_; 65 int64_t display_id_;
98 const RootWindowType root_window_type_;
99 66
100 WindowTreeHostMusDelegate* delegate_; 67 WindowTreeHostMusDelegate* delegate_;
101 68
102 bool in_set_bounds_from_server_ = false; 69 bool in_set_bounds_from_server_ = false;
103 70
104 gfx::Vector2d origin_offset_;
105
106 // May be null, see class description.
107 Window* content_window_;
108
109 std::unique_ptr<ContentWindowObserver> content_window_observer_;
110 std::unique_ptr<InputMethodMus> input_method_; 71 std::unique_ptr<InputMethodMus> input_method_;
111 72
112 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); 73 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus);
113 }; 74 };
114 75
115 } // namespace aura 76 } // namespace aura
116 77
117 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ 78 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698