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

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

Issue 128753002: Remove SetHostSize/Bounds from RootWindow in favor of just calling SetBounds() on host() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: weirdness 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 | « ui/aura/root_window.h ('k') | 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
224 void RootWindow::SetCursor(gfx::NativeCursor cursor) { 197 void RootWindow::SetCursor(gfx::NativeCursor cursor) {
225 last_cursor_ = cursor; 198 last_cursor_ = cursor;
226 // A lot of code seems to depend on NULL cursors actually showing an arrow, 199 // A lot of code seems to depend on NULL cursors actually showing an arrow,
227 // so just pass everything along to the host. 200 // so just pass everything along to the host.
228 host_->SetCursor(cursor); 201 host_->SetCursor(cursor);
229 } 202 }
230 203
231 void RootWindow::OnCursorVisibilityChanged(bool show) { 204 void RootWindow::OnCursorVisibilityChanged(bool show) {
232 // Clear any existing mouse hover effects when the cursor becomes invisible. 205 // Clear any existing mouse hover effects when the cursor becomes invisible.
233 // Note we do not need to dispatch a mouse enter when the cursor becomes 206 // 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
733 706
734 void RootWindow::OnHostResized(const gfx::Size& size) { 707 void RootWindow::OnHostResized(const gfx::Size& size) {
735 TRACE_EVENT1("ui", "RootWindow::OnHostResized", 708 TRACE_EVENT1("ui", "RootWindow::OnHostResized",
736 "size", size.ToString()); 709 "size", size.ToString());
737 710
738 DispatchDetails details = DispatchHeldEvents(); 711 DispatchDetails details = DispatchHeldEvents();
739 if (details.dispatcher_destroyed) 712 if (details.dispatcher_destroyed)
740 return; 713 return;
741 FOR_EACH_OBSERVER(RootWindowObserver, observers_, 714 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
742 OnWindowTreeHostResized(this)); 715 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;
743 } 724 }
744 725
745 RootWindow* RootWindow::AsRootWindow() { 726 RootWindow* RootWindow::AsRootWindow() {
746 return this; 727 return this;
747 } 728 }
748 729
749 const RootWindow* RootWindow::AsRootWindow() const { 730 const RootWindow* RootWindow::AsRootWindow() const {
750 return this; 731 return this;
751 } 732 }
752 733
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 break; 988 break;
1008 989
1009 default: 990 default:
1010 NOTREACHED(); 991 NOTREACHED();
1011 break; 992 break;
1012 } 993 }
1013 PreDispatchLocatedEvent(target, event); 994 PreDispatchLocatedEvent(target, event);
1014 } 995 }
1015 996
1016 } // namespace aura 997 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698