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

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

Issue 10828133: Desktop Aura: Allow tab drags out of window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 8 years, 4 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/root_window_host.h » ('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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 compositor()->SetRootLayer(layer()); 173 compositor()->SetRootLayer(layer());
174 SetBounds( 174 SetBounds(
175 ui::ConvertRectToDIP(layer(), gfx::Rect(host_->GetBounds().size()))); 175 ui::ConvertRectToDIP(layer(), gfx::Rect(host_->GetBounds().size())));
176 Show(); 176 Show();
177 } 177 }
178 178
179 void RootWindow::ShowRootWindow() { 179 void RootWindow::ShowRootWindow() {
180 host_->Show(); 180 host_->Show();
181 } 181 }
182 182
183 void RootWindow::HideRootWindow() {
184 host_->Hide();
185 }
186
183 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() { 187 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() {
184 return this; 188 return this;
185 } 189 }
186 190
187 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { 191 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) {
188 DispatchHeldMouseMove(); 192 DispatchHeldMouseMove();
189 gfx::Rect bounds = host_->GetBounds(); 193 gfx::Rect bounds = host_->GetBounds();
190 bounds.set_size(size_in_pixel); 194 bounds.set_size(size_in_pixel);
191 host_->SetBounds(bounds); 195 host_->SetBounds(bounds);
192 196
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 //////////////////////////////////////////////////////////////////////////////// 525 ////////////////////////////////////////////////////////////////////////////////
522 // RootWindow, overridden from aura::client::CaptureDelegate: 526 // RootWindow, overridden from aura::client::CaptureDelegate:
523 527
524 void RootWindow::UpdateCapture(Window* old_capture, 528 void RootWindow::UpdateCapture(Window* old_capture,
525 Window* new_capture) { 529 Window* new_capture) {
526 if (old_capture && old_capture->GetRootWindow() == this && 530 if (old_capture && old_capture->GetRootWindow() == this &&
527 old_capture->delegate()) { 531 old_capture->delegate()) {
528 // Send a capture changed event with bogus location data. 532 // Send a capture changed event with bogus location data.
529 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), 533 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(),
530 gfx::Point(), 0); 534 gfx::Point(), 0);
535
531 ProcessMouseEvent(old_capture, &event); 536 ProcessMouseEvent(old_capture, &event);
532 537
533 old_capture->delegate()->OnCaptureLost(); 538 old_capture->delegate()->OnCaptureLost();
534 } 539 }
535 540
536 // Reset the mouse_moved_handler_ if the mouse_moved_handler_ belongs 541 // Reset the mouse_moved_handler_ if the mouse_moved_handler_ belongs
537 // to another root window when losing the capture. 542 // to another root window when losing the capture.
538 if (mouse_moved_handler_ && old_capture && 543 if (mouse_moved_handler_ && old_capture &&
539 old_capture->Contains(mouse_moved_handler_) && 544 old_capture->Contains(mouse_moved_handler_) &&
540 old_capture->GetRootWindow() != this) { 545 old_capture->GetRootWindow() != this) {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 void RootWindow::OnHostLostCapture() { 919 void RootWindow::OnHostLostCapture() {
915 Window* capture_window = client::GetCaptureWindow(this); 920 Window* capture_window = client::GetCaptureWindow(this);
916 if (capture_window && capture_window->GetRootWindow() == this) 921 if (capture_window && capture_window->GetRootWindow() == this)
917 capture_window->ReleaseCapture(); 922 capture_window->ReleaseCapture();
918 } 923 }
919 924
920 void RootWindow::OnHostPaint() { 925 void RootWindow::OnHostPaint() {
921 Draw(); 926 Draw();
922 } 927 }
923 928
929 void RootWindow::OnHostMoved(const gfx::Point& origin) {
930 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
931 OnRootWindowMoved(this, origin));
932 }
933
924 void RootWindow::OnHostResized(const gfx::Size& size) { 934 void RootWindow::OnHostResized(const gfx::Size& size) {
925 DispatchHeldMouseMove(); 935 DispatchHeldMouseMove();
926 // The compositor should have the same size as the native root window host. 936 // The compositor should have the same size as the native root window host.
927 // Get the latest scale from display because it might have been changed. 937 // Get the latest scale from display because it might have been changed.
928 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this), 938 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this),
929 size); 939 size);
930 gfx::Size old(bounds().size()); 940 gfx::Size old(bounds().size());
931 // The layer, and all the observers should be notified of the 941 // The layer, and all the observers should be notified of the
932 // transformed size of the root window. 942 // transformed size of the root window.
933 gfx::Rect bounds(ui::ConvertSizeToDIP(layer(), size)); 943 gfx::Rect bounds(ui::ConvertSizeToDIP(layer(), size));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 transform.ConcatScale(scale, scale); 1042 transform.ConcatScale(scale, scale);
1033 transform.TransformPoint(point); 1043 transform.TransformPoint(point);
1034 gfx::Point orig_mouse_location = point.AsPoint(); 1044 gfx::Point orig_mouse_location = point.AsPoint();
1035 1045
1036 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's 1046 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's
1037 // currently broken. See/ crbug.com/107931. 1047 // currently broken. See/ crbug.com/107931.
1038 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 1048 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
1039 orig_mouse_location, 1049 orig_mouse_location,
1040 orig_mouse_location, 1050 orig_mouse_location,
1041 ui::EF_IS_SYNTHESIZED); 1051 ui::EF_IS_SYNTHESIZED);
1052 event.set_system_location(Env::GetInstance()->last_mouse_location());
1042 OnHostMouseEvent(&event); 1053 OnHostMouseEvent(&event);
1043 #endif 1054 #endif
1044 } 1055 }
1045 1056
1046 void RootWindow::UnlockCompositor() { 1057 void RootWindow::UnlockCompositor() {
1047 DCHECK(compositor_lock_); 1058 DCHECK(compositor_lock_);
1048 compositor_lock_ = NULL; 1059 compositor_lock_ = NULL;
1049 if (draw_on_compositor_unlock_) { 1060 if (draw_on_compositor_unlock_) {
1050 draw_on_compositor_unlock_ = false; 1061 draw_on_compositor_unlock_ = false;
1051 ScheduleDraw(); 1062 ScheduleDraw();
1052 } 1063 }
1053 } 1064 }
1054 1065
1055 } // namespace aura 1066 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698