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

Side by Side Diff: ash/wm/toplevel_window_event_handler.cc

Issue 149063003: Check WindowDelegate in the methods which assume the target has the delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « no previous file | no next file » | 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 "ash/wm/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_event_handler.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/resize_shadow_controller.h" 8 #include "ash/wm/resize_shadow_controller.h"
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 drag_reverted_ = (status == DRAG_REVERT); 345 drag_reverted_ = (status == DRAG_REVERT);
346 346
347 in_gesture_drag_ = false; 347 in_gesture_drag_ = false;
348 if (in_move_loop_) 348 if (in_move_loop_)
349 quit_closure_.Run(); 349 quit_closure_.Run();
350 } 350 }
351 351
352 void ToplevelWindowEventHandler::HandleMousePressed( 352 void ToplevelWindowEventHandler::HandleMousePressed(
353 aura::Window* target, 353 aura::Window* target,
354 ui::MouseEvent* event) { 354 ui::MouseEvent* event) {
355 if (event->phase() != ui::EP_PRETARGET) 355 if (event->phase() != ui::EP_PRETARGET || !target->delegate())
356 return; 356 return;
357 357
358 // We also update the current window component here because for the 358 // We also update the current window component here because for the
359 // mouse-drag-release-press case, where the mouse is released and 359 // mouse-drag-release-press case, where the mouse is released and
360 // pressed without mouse move event. 360 // pressed without mouse move event.
361 int component = 361 int component =
362 target->delegate()->GetNonClientComponent(event->location()); 362 target->delegate()->GetNonClientComponent(event->location());
363 if ((event->flags() & 363 if ((event->flags() &
364 (ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0 && 364 (ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0 &&
365 WindowResizer::GetBoundsChangeForWindowComponent(component)) { 365 WindowResizer::GetBoundsChangeForWindowComponent(component)) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 ConvertPointToParent(target, event->location()), event->flags()); 410 ConvertPointToParent(target, event->location()), event->flags());
411 event->StopPropagation(); 411 event->StopPropagation();
412 } 412 }
413 413
414 void ToplevelWindowEventHandler::HandleMouseMoved( 414 void ToplevelWindowEventHandler::HandleMouseMoved(
415 aura::Window* target, 415 aura::Window* target,
416 ui::LocatedEvent* event) { 416 ui::LocatedEvent* event) {
417 // Shadow effects are applied after target handling. Note that we don't 417 // Shadow effects are applied after target handling. Note that we don't
418 // respect ER_HANDLED here right now since we have not had a reason to allow 418 // respect ER_HANDLED here right now since we have not had a reason to allow
419 // the target to cancel shadow rendering. 419 // the target to cancel shadow rendering.
420 if (event->phase() != ui::EP_POSTTARGET) 420 if (event->phase() != ui::EP_POSTTARGET || !target->delegate())
421 return; 421 return;
422 422
423 // TODO(jamescook): Move the resize cursor update code into here from 423 // TODO(jamescook): Move the resize cursor update code into here from
424 // CompoundEventFilter? 424 // CompoundEventFilter?
425 internal::ResizeShadowController* controller = 425 internal::ResizeShadowController* controller =
426 Shell::GetInstance()->resize_shadow_controller(); 426 Shell::GetInstance()->resize_shadow_controller();
427 if (controller) { 427 if (controller) {
428 if (event->flags() & ui::EF_IS_NON_CLIENT) { 428 if (event->flags() & ui::EF_IS_NON_CLIENT) {
429 int component = 429 int component =
430 target->delegate()->GetNonClientComponent(event->location()); 430 target->delegate()->GetNonClientComponent(event->location());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { 490 void ToplevelWindowEventHandler::ResizerWindowDestroyed() {
491 // We explicitly don't invoke RevertDrag() since that may do things to window. 491 // We explicitly don't invoke RevertDrag() since that may do things to window.
492 // Instead we destroy the resizer. 492 // Instead we destroy the resizer.
493 window_resizer_.reset(); 493 window_resizer_.reset();
494 494
495 CompleteDrag(DRAG_REVERT); 495 CompleteDrag(DRAG_REVERT);
496 } 496 }
497 497
498 } // namespace ash 498 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698