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

Side by Side Diff: mojo/services/view_manager/display_manager.cc

Issue 536153002: mojo: Fix window resizing in mojo_sample_app and mojo_demo_launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 | « mojo/examples/sample_app/gles2_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "mojo/services/view_manager/display_manager.h" 5 #include "mojo/services/view_manager/display_manager.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/scoped_observer.h" 8 #include "base/scoped_observer.h"
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" 10 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 for (size_t i = 0; i < children.size(); ++i) { 50 for (size_t i = 0; i < children.size(); ++i) {
51 PaintViewTree( 51 PaintViewTree(
52 canvas, children[i], origin + children[i]->bounds().OffsetFromOrigin()); 52 canvas, children[i], origin + children[i]->bounds().OffsetFromOrigin());
53 } 53 }
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 class DisplayManager::RootWindowDelegateImpl : public aura::WindowDelegate { 58 class DisplayManager::RootWindowDelegateImpl : public aura::WindowDelegate {
59 public: 59 public:
60 explicit RootWindowDelegateImpl(const ServerView* root_view) 60 explicit RootWindowDelegateImpl(ConnectionManager* connection_manager)
61 : root_view_(root_view) {} 61 : connection_manager_(connection_manager) {}
62 virtual ~RootWindowDelegateImpl() {} 62 virtual ~RootWindowDelegateImpl() {}
63 63
64 // aura::WindowDelegate: 64 // aura::WindowDelegate:
65 virtual gfx::Size GetMinimumSize() const OVERRIDE { 65 virtual gfx::Size GetMinimumSize() const OVERRIDE {
66 return gfx::Size(); 66 return gfx::Size();
67 } 67 }
68 virtual gfx::Size GetMaximumSize() const OVERRIDE { 68 virtual gfx::Size GetMaximumSize() const OVERRIDE {
69 return gfx::Size(); 69 return gfx::Size();
70 } 70 }
71 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, 71 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
72 const gfx::Rect& new_bounds) OVERRIDE { 72 const gfx::Rect& new_bounds) OVERRIDE {
73 connection_manager_->ProcessViewBoundsChanged(connection_manager_->root(),
74 old_bounds,
75 new_bounds);
73 } 76 }
74 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { 77 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
75 return gfx::kNullCursor; 78 return gfx::kNullCursor;
76 } 79 }
77 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { 80 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
78 return HTCAPTION; 81 return HTCAPTION;
79 } 82 }
80 virtual bool ShouldDescendIntoChildForEventHandling( 83 virtual bool ShouldDescendIntoChildForEventHandling(
81 aura::Window* child, 84 aura::Window* child,
82 const gfx::Point& location) OVERRIDE { 85 const gfx::Point& location) OVERRIDE {
83 return true; 86 return true;
84 } 87 }
85 virtual bool CanFocus() OVERRIDE { 88 virtual bool CanFocus() OVERRIDE {
86 return true; 89 return true;
87 } 90 }
88 virtual void OnCaptureLost() OVERRIDE { 91 virtual void OnCaptureLost() OVERRIDE {
89 } 92 }
90 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 93 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
91 PaintViewTree(canvas, root_view_, gfx::Point()); 94 PaintViewTree(canvas, connection_manager_->root(), gfx::Point());
92 } 95 }
93 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { 96 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
94 } 97 }
95 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { 98 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
96 } 99 }
97 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { 100 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {
98 } 101 }
99 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE { 102 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {
100 } 103 }
101 virtual bool HasHitTestMask() const OVERRIDE { 104 virtual bool HasHitTestMask() const OVERRIDE {
102 return false; 105 return false;
103 } 106 }
104 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { 107 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {
105 } 108 }
106 109
107 private: 110 private:
108 const ServerView* root_view_; 111 ConnectionManager* connection_manager_;
109 112
110 DISALLOW_COPY_AND_ASSIGN(RootWindowDelegateImpl); 113 DISALLOW_COPY_AND_ASSIGN(RootWindowDelegateImpl);
111 }; 114 };
112 115
113 // TODO(sky): Remove once aura is removed from the service. 116 // TODO(sky): Remove once aura is removed from the service.
114 class FocusClientImpl : public aura::client::FocusClient { 117 class FocusClientImpl : public aura::client::FocusClient {
115 public: 118 public:
116 FocusClientImpl() {} 119 FocusClientImpl() {}
117 virtual ~FocusClientImpl() {} 120 virtual ~FocusClientImpl() {}
118 121
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const gfx::Rect& bounds) { 199 const gfx::Rect& bounds) {
197 if (root_window_) 200 if (root_window_)
198 root_window_->SchedulePaintInRect(ConvertRectToRoot(view, bounds)); 201 root_window_->SchedulePaintInRect(ConvertRectToRoot(view, bounds));
199 } 202 }
200 203
201 void DisplayManager::OnCompositorCreated() { 204 void DisplayManager::OnCompositorCreated() {
202 base::AutoReset<bool> resetter(&in_setup_, true); 205 base::AutoReset<bool> resetter(&in_setup_, true);
203 window_tree_host_->InitHost(); 206 window_tree_host_->InitHost();
204 207
205 window_delegate_.reset( 208 window_delegate_.reset(
206 new RootWindowDelegateImpl(connection_manager_->root())); 209 new RootWindowDelegateImpl(connection_manager_));
207 root_window_ = new aura::Window(window_delegate_.get()); 210 root_window_ = new aura::Window(window_delegate_.get());
208 root_window_->Init(aura::WINDOW_LAYER_TEXTURED); 211 root_window_->Init(aura::WINDOW_LAYER_TEXTURED);
209 root_window_->Show(); 212 root_window_->Show();
210 root_window_->SetBounds( 213 root_window_->SetBounds(
211 gfx::Rect(window_tree_host_->window()->bounds().size())); 214 gfx::Rect(window_tree_host_->window()->bounds().size()));
212 window_tree_host_->window()->AddChild(root_window_); 215 window_tree_host_->window()->AddChild(root_window_);
213 216
214 connection_manager_->root()->SetBounds( 217 connection_manager_->root()->SetBounds(
215 gfx::Rect(window_tree_host_->window()->bounds().size())); 218 gfx::Rect(window_tree_host_->window()->bounds().size()));
216 219
217 window_tree_client_.reset( 220 window_tree_client_.reset(
218 new WindowTreeClientImpl(window_tree_host_->window())); 221 new WindowTreeClientImpl(window_tree_host_->window()));
219 222
220 focus_client_.reset(new FocusClientImpl); 223 focus_client_.reset(new FocusClientImpl);
221 aura::client::SetFocusClient(window_tree_host_->window(), 224 aura::client::SetFocusClient(window_tree_host_->window(),
222 focus_client_.get()); 225 focus_client_.get());
223 226
224 window_tree_host_->Show(); 227 window_tree_host_->Show();
225 228
226 delegate_->OnDisplayManagerWindowTreeHostCreated(); 229 delegate_->OnDisplayManagerWindowTreeHostCreated();
227 } 230 }
228 231
229 } // namespace service 232 } // namespace service
230 } // namespace mojo 233 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/gles2_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698