Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/app_list_controller.h" | 5 #include "ash/wm/app_list_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 animation.SetTransitionDuration( | 282 animation.SetTransitionDuration( |
| 283 base::TimeDelta::FromMilliseconds( | 283 base::TimeDelta::FromMilliseconds( |
| 284 is_visible_ ? 0 : kAnimationDurationMs)); | 284 is_visible_ ? 0 : kAnimationDurationMs)); |
| 285 animation.AddObserver(this); | 285 animation.AddObserver(this); |
| 286 | 286 |
| 287 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); | 287 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); |
| 288 widget->SetBounds(target_bounds); | 288 widget->SetBounds(target_bounds); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) { | 291 void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) { |
| 292 if (!view_ || !is_visible_) | |
| 293 return; | |
| 294 | |
| 292 // If the event happened on a menu, then the event should not close the app | 295 // If the event happened on a menu, then the event should not close the app |
| 293 // list. | 296 // list. |
| 294 aura::Window* target = static_cast<aura::Window*>(event->target()); | 297 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 295 if (target) { | 298 if (target) { |
| 296 RootWindowController* root_controller = | 299 RootWindowController* root_controller = |
| 297 GetRootWindowController(target->GetRootWindow()); | 300 GetRootWindowController(target->GetRootWindow()); |
| 298 if (root_controller) { | 301 if (root_controller) { |
| 299 aura::Window* menu_container = root_controller->GetContainer( | 302 aura::Window* menu_container = root_controller->GetContainer( |
| 300 internal::kShellWindowId_MenuContainer); | 303 internal::kShellWindowId_MenuContainer); |
| 301 if (menu_container->Contains(target)) | 304 if (menu_container->Contains(target)) |
| 302 return; | 305 return; |
| 303 aura::Window* keyboard_container = root_controller->GetContainer( | 306 aura::Window* keyboard_container = root_controller->GetContainer( |
| 304 internal::kShellWindowId_VirtualKeyboardContainer); | 307 internal::kShellWindowId_VirtualKeyboardContainer); |
| 305 if (keyboard_container->Contains(target)) | 308 if (keyboard_container->Contains(target)) |
| 306 return; | 309 return; |
| 307 } | 310 } |
| 308 } | 311 } |
| 309 | 312 |
| 310 if (view_ && is_visible_) { | 313 aura::Window* window = view_->GetWidget()->GetNativeView(); |
|
sky
2014/02/24 21:04:38
Is the coordinate system here right?
sadrul
2014/02/24 21:10:16
The altered code doesn't actually deal with coordi
sky
2014/02/24 21:11:38
Indeed. The old code was doing conversions though.
| |
| 311 aura::Window* window = view_->GetWidget()->GetNativeView(); | 314 if (!window->Contains(target)) |
| 312 gfx::Point window_local_point(event->root_location()); | 315 SetVisible(false, window); |
| 313 aura::Window::ConvertPointToTarget(window->GetRootWindow(), | |
| 314 window, | |
| 315 &window_local_point); | |
| 316 // Use HitTest to respect the hit test mask of the bubble. | |
| 317 if (!window->HitTest(window_local_point)) | |
| 318 SetVisible(false, window); | |
| 319 } | |
| 320 } | 316 } |
| 321 | 317 |
| 322 void AppListController::UpdateBounds() { | 318 void AppListController::UpdateBounds() { |
| 323 if (view_ && is_visible_) | 319 if (view_ && is_visible_) |
| 324 view_->UpdateBounds(); | 320 view_->UpdateBounds(); |
| 325 } | 321 } |
| 326 | 322 |
| 327 //////////////////////////////////////////////////////////////////////////////// | 323 //////////////////////////////////////////////////////////////////////////////// |
| 328 // AppListController, aura::EventFilter implementation: | 324 // AppListController, aura::EventFilter implementation: |
| 329 | 325 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 should_snap_back_ = false; | 436 should_snap_back_ = false; |
| 441 ui::ScopedLayerAnimationSettings animation(widget_animator); | 437 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 442 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 438 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 443 app_list::kOverscrollPageTransitionDurationMs)); | 439 app_list::kOverscrollPageTransitionDurationMs)); |
| 444 widget->SetBounds(view_bounds_); | 440 widget->SetBounds(view_bounds_); |
| 445 } | 441 } |
| 446 } | 442 } |
| 447 | 443 |
| 448 } // namespace internal | 444 } // namespace internal |
| 449 } // namespace ash | 445 } // namespace ash |
| OLD | NEW |