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

Side by Side Diff: trunk/src/ui/aura/root_window.cc

Issue 133003002: Revert 244005 "Remove SetHostSize/Bounds from RootWindow in favo..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/aura/root_window.h ('k') | trunk/src/ui/aura/test/aura_test_helper.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 held_repostable_event_.reset(); 187 held_repostable_event_.reset();
188 // TODO(rbyers): Reposing of gestures is tricky to get 188 // TODO(rbyers): Reposing of gestures is tricky to get
189 // right, so it's not yet supported. crbug.com/170987. 189 // right, so it's not yet supported. crbug.com/170987.
190 } 190 }
191 } 191 }
192 192
193 WindowTreeHostDelegate* RootWindow::AsWindowTreeHostDelegate() { 193 WindowTreeHostDelegate* RootWindow::AsWindowTreeHostDelegate() {
194 return this; 194 return this;
195 } 195 }
196 196
197 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) {
198 DispatchDetails details = DispatchHeldEvents();
199 if (details.dispatcher_destroyed)
200 return;
201 gfx::Rect bounds = host_->GetBounds();
202 bounds.set_size(size_in_pixel);
203 host_->SetBounds(bounds);
204
205 // Requery the location to constrain it within the new root window size.
206 gfx::Point point;
207 if (host_->QueryMouseLocation(&point)) {
208 SetLastMouseLocation(window(),
209 ui::ConvertPointToDIP(window()->layer(), point));
210 }
211
212 synthesize_mouse_move_ = false;
213 }
214
215 void RootWindow::SetHostBounds(const gfx::Rect& bounds_in_pixel) {
216 DCHECK(!bounds_in_pixel.IsEmpty());
217 DispatchDetails details = DispatchHeldEvents();
218 if (details.dispatcher_destroyed)
219 return;
220 host_->SetBounds(bounds_in_pixel);
221 synthesize_mouse_move_ = false;
222 }
223
197 void RootWindow::SetCursor(gfx::NativeCursor cursor) { 224 void RootWindow::SetCursor(gfx::NativeCursor cursor) {
198 last_cursor_ = cursor; 225 last_cursor_ = cursor;
199 // A lot of code seems to depend on NULL cursors actually showing an arrow, 226 // A lot of code seems to depend on NULL cursors actually showing an arrow,
200 // so just pass everything along to the host. 227 // so just pass everything along to the host.
201 host_->SetCursor(cursor); 228 host_->SetCursor(cursor);
202 } 229 }
203 230
204 void RootWindow::OnCursorVisibilityChanged(bool show) { 231 void RootWindow::OnCursorVisibilityChanged(bool show) {
205 // Clear any existing mouse hover effects when the cursor becomes invisible. 232 // Clear any existing mouse hover effects when the cursor becomes invisible.
206 // Note we do not need to dispatch a mouse enter when the cursor becomes 233 // Note we do not need to dispatch a mouse enter when the cursor becomes
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 733
707 void RootWindow::OnHostResized(const gfx::Size& size) { 734 void RootWindow::OnHostResized(const gfx::Size& size) {
708 TRACE_EVENT1("ui", "RootWindow::OnHostResized", 735 TRACE_EVENT1("ui", "RootWindow::OnHostResized",
709 "size", size.ToString()); 736 "size", size.ToString());
710 737
711 DispatchDetails details = DispatchHeldEvents(); 738 DispatchDetails details = DispatchHeldEvents();
712 if (details.dispatcher_destroyed) 739 if (details.dispatcher_destroyed)
713 return; 740 return;
714 FOR_EACH_OBSERVER(RootWindowObserver, observers_, 741 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
715 OnWindowTreeHostResized(this)); 742 OnWindowTreeHostResized(this));
716
717 // Constrain the mouse position within the new root Window size.
718 gfx::Point point;
719 if (host_->QueryMouseLocation(&point)) {
720 SetLastMouseLocation(window(),
721 ui::ConvertPointToDIP(window()->layer(), point));
722 }
723 synthesize_mouse_move_ = false;
724 } 743 }
725 744
726 RootWindow* RootWindow::AsRootWindow() { 745 RootWindow* RootWindow::AsRootWindow() {
727 return this; 746 return this;
728 } 747 }
729 748
730 const RootWindow* RootWindow::AsRootWindow() const { 749 const RootWindow* RootWindow::AsRootWindow() const {
731 return this; 750 return this;
732 } 751 }
733 752
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 break; 1007 break;
989 1008
990 default: 1009 default:
991 NOTREACHED(); 1010 NOTREACHED();
992 break; 1011 break;
993 } 1012 }
994 PreDispatchLocatedEvent(target, event); 1013 PreDispatchLocatedEvent(target, event);
995 } 1014 }
996 1015
997 } // namespace aura 1016 } // namespace aura
OLDNEW
« no previous file with comments | « trunk/src/ui/aura/root_window.h ('k') | trunk/src/ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698