OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/desktop.h" | 5 #include "ui/aura/desktop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 526 |
527 Desktop* Desktop::GetDesktop() { | 527 Desktop* Desktop::GetDesktop() { |
528 return this; | 528 return this; |
529 } | 529 } |
530 | 530 |
531 void Desktop::WindowDetachedFromDesktop(Window* detached) { | 531 void Desktop::WindowDetachedFromDesktop(Window* detached) { |
532 DCHECK(capture_window_ != this); | 532 DCHECK(capture_window_ != this); |
533 | 533 |
534 // If the ancestor of the capture window is detached, | 534 // If the ancestor of the capture window is detached, |
535 // release the capture. | 535 // release the capture. |
536 aura::Window* window = capture_window_; | 536 if (detached->Contains(capture_window_) && detached != this) |
537 while (window && window != detached) | |
538 window = window->parent(); | |
539 if (window && window != this) | |
540 ReleaseCapture(capture_window_); | 537 ReleaseCapture(capture_window_); |
541 | 538 |
542 // If the ancestor of the capture window is detached, | 539 // If the ancestor of the focused window is detached, |
543 // release the focus. | 540 // release the focus. |
544 window = focused_window_; | 541 if (detached->Contains(focused_window_)) |
545 while (window && window != detached) | |
546 window = window->parent(); | |
547 if (window) | |
548 SetFocusedWindow(NULL); | 542 SetFocusedWindow(NULL); |
| 543 |
| 544 // If the ancestor of any event handler windows are detached, release the |
| 545 // pointer to those windows. |
| 546 if (detached->Contains(mouse_pressed_handler_)) |
| 547 mouse_pressed_handler_ = NULL; |
| 548 if (detached->Contains(mouse_moved_handler_)) |
| 549 mouse_moved_handler_ = NULL; |
| 550 if (detached->Contains(touch_event_handler_)) |
| 551 touch_event_handler_ = NULL; |
549 } | 552 } |
550 | 553 |
551 void Desktop::OnLayerAnimationEnded( | 554 void Desktop::OnLayerAnimationEnded( |
552 const ui::LayerAnimationSequence* animation) { | 555 const ui::LayerAnimationSequence* animation) { |
553 OnHostResized(host_->GetSize()); | 556 OnHostResized(host_->GetSize()); |
554 } | 557 } |
555 | 558 |
556 void Desktop::OnLayerAnimationScheduled( | 559 void Desktop::OnLayerAnimationScheduled( |
557 const ui::LayerAnimationSequence* animation) { | 560 const ui::LayerAnimationSequence* animation) { |
558 } | 561 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 605 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
603 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 606 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
604 } else if (use_fullscreen_host_window_) { | 607 } else if (use_fullscreen_host_window_) { |
605 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 608 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
606 } | 609 } |
607 | 610 |
608 return bounds; | 611 return bounds; |
609 } | 612 } |
610 | 613 |
611 } // namespace aura | 614 } // namespace aura |
OLD | NEW |