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/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/workspace/multi_window_resize_controller.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
24 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
26 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
27 #include "ui/wm/core/compound_event_filter.h" | 27 #include "ui/wm/core/compound_event_filter.h" |
28 | 28 |
29 using aura::Window; | 29 using aura::Window; |
30 | 30 |
31 namespace ash { | 31 namespace ash { |
32 namespace internal { | |
33 | |
34 namespace { | 32 namespace { |
35 | 33 |
36 // Delay before showing. | 34 // Delay before showing. |
37 const int kShowDelayMS = 400; | 35 const int kShowDelayMS = 400; |
38 | 36 |
39 // Delay before hiding. | 37 // Delay before hiding. |
40 const int kHideDelayMS = 500; | 38 const int kHideDelayMS = 500; |
41 | 39 |
42 // Padding from the bottom/right edge the resize widget is shown at. | 40 // Padding from the bottom/right edge the resize widget is shown at. |
43 const int kResizeWidgetPadding = 15; | 41 const int kResizeWidgetPadding = 15; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 377 } |
380 | 378 |
381 void MultiWindowResizeController::ShowNow() { | 379 void MultiWindowResizeController::ShowNow() { |
382 DCHECK(!resize_widget_.get()); | 380 DCHECK(!resize_widget_.get()); |
383 DCHECK(windows_.is_valid()); | 381 DCHECK(windows_.is_valid()); |
384 show_timer_.Stop(); | 382 show_timer_.Stop(); |
385 resize_widget_.reset(new views::Widget); | 383 resize_widget_.reset(new views::Widget); |
386 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 384 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
387 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 385 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
388 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 386 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
389 params.parent = Shell::GetContainer( | 387 params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(), |
390 Shell::GetTargetRootWindow(), | 388 kShellWindowId_AlwaysOnTopContainer); |
391 internal::kShellWindowId_AlwaysOnTopContainer); | |
392 params.can_activate = false; | 389 params.can_activate = false; |
393 ResizeView* view = new ResizeView(this, windows_.direction); | 390 ResizeView* view = new ResizeView(this, windows_.direction); |
394 resize_widget_->set_focus_on_creation(false); | 391 resize_widget_->set_focus_on_creation(false); |
395 resize_widget_->Init(params); | 392 resize_widget_->Init(params); |
396 ::wm::SetWindowVisibilityAnimationType( | 393 ::wm::SetWindowVisibilityAnimationType( |
397 resize_widget_->GetNativeWindow(), | 394 resize_widget_->GetNativeWindow(), |
398 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 395 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
399 resize_widget_->GetNativeWindow()->SetName("MultiWindowResizeController"); | 396 resize_widget_->GetNativeWindow()->SetName("MultiWindowResizeController"); |
400 resize_widget_->SetContentsView(view); | 397 resize_widget_->SetContentsView(view); |
401 show_bounds_in_screen_ = ScreenUtil::ConvertRectToScreen( | 398 show_bounds_in_screen_ = ScreenUtil::ConvertRectToScreen( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 if (!window->delegate()) | 533 if (!window->delegate()) |
537 return false; | 534 return false; |
538 | 535 |
539 gfx::Point window_loc(location_in_screen); | 536 gfx::Point window_loc(location_in_screen); |
540 aura::Window::ConvertPointToTarget( | 537 aura::Window::ConvertPointToTarget( |
541 window->GetRootWindow(), window, &window_loc); | 538 window->GetRootWindow(), window, &window_loc); |
542 return window->ContainsPoint(window_loc) && | 539 return window->ContainsPoint(window_loc) && |
543 window->delegate()->GetNonClientComponent(window_loc) == component; | 540 window->delegate()->GetNonClientComponent(window_loc) == component; |
544 } | 541 } |
545 | 542 |
546 } // namespace internal | |
547 } // namespace ash | 543 } // namespace ash |
OLD | NEW |