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

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

Issue 8700013: Release aura::Desktop event handler windows on detaching an ancestor window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use parent_ to access parent. Created 9 years 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 | « no previous file | ui/aura/window.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) 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
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698