OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overview/scoped_transform_overview_window.h" | 5 #include "ash/wm/overview/scoped_transform_overview_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/wm/overview/scoped_overview_animation_settings.h" | 11 #include "ash/wm/overview/scoped_overview_animation_settings.h" |
12 #include "ash/wm/overview/window_selector_item.h" | 12 #include "ash/wm/overview/window_selector_item.h" |
13 #include "ash/wm/splitview/split_view_controller.h" | |
13 #include "ash/wm/window_mirror_view.h" | 14 #include "ash/wm/window_mirror_view.h" |
14 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
15 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
19 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
20 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
22 #include "ui/compositor/layer.h" | 23 #include "ui/compositor/layer.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 | 159 |
159 TransientDescendantIteratorRange GetTransientTreeIterator( | 160 TransientDescendantIteratorRange GetTransientTreeIterator( |
160 aura::Window* window) { | 161 aura::Window* window) { |
161 return TransientDescendantIteratorRange( | 162 return TransientDescendantIteratorRange( |
162 TransientDescendantIterator(GetTransientRoot(window))); | 163 TransientDescendantIterator(GetTransientRoot(window))); |
163 } | 164 } |
164 | 165 |
165 } // namespace | 166 } // namespace |
166 | 167 |
167 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( | 168 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( |
169 WindowSelectorItem* selector_item, | |
168 aura::Window* window) | 170 aura::Window* window) |
169 : window_(window), | 171 : selector_item_(selector_item), |
172 window_(window), | |
170 determined_original_window_shape_(false), | 173 determined_original_window_shape_(false), |
171 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()), | 174 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()), |
172 overview_started_(false), | 175 overview_started_(false), |
173 original_transform_(window->layer()->GetTargetTransform()), | 176 original_transform_(window->layer()->GetTargetTransform()), |
174 original_opacity_(window->layer()->GetTargetOpacity()), | 177 original_opacity_(window->layer()->GetTargetOpacity()), |
175 weak_ptr_factory_(this) {} | 178 weak_ptr_factory_(this) {} |
176 | 179 |
177 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} | 180 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} |
178 | 181 |
179 void ScopedTransformOverviewWindow::RestoreWindow() { | 182 void ScopedTransformOverviewWindow::RestoreWindow() { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 if (minimized_widget_) | 450 if (minimized_widget_) |
448 return GetOverviewWindowForMinimizedState(); | 451 return GetOverviewWindowForMinimizedState(); |
449 return window_; | 452 return window_; |
450 } | 453 } |
451 | 454 |
452 void ScopedTransformOverviewWindow::EnsureVisible() { | 455 void ScopedTransformOverviewWindow::EnsureVisible() { |
453 original_opacity_ = 1.f; | 456 original_opacity_ = 1.f; |
454 } | 457 } |
455 | 458 |
456 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) { | 459 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) { |
457 if (event->type() == ui::ET_GESTURE_TAP) { | 460 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) { |
461 gfx::Point location(event->location()); | |
462 ::wm::ConvertPointToScreen(minimized_widget_->GetNativeWindow(), &location); | |
463 switch (event->type()) { | |
464 case ui::ET_GESTURE_SCROLL_BEGIN: | |
465 case ui::ET_GESTURE_TAP_DOWN: { | |
466 selector_item_->HandlePressEvent(location); | |
467 break; | |
468 } | |
oshima
2017/06/14 00:19:27
nuke {}
xdai1
2017/06/15 22:11:41
Done.
| |
469 case ui::ET_GESTURE_SCROLL_UPDATE: | |
470 selector_item_->HandleDragEvent(location); | |
471 break; | |
472 case ui::ET_GESTURE_END: | |
473 selector_item_->HandleReleaseEvent(location); | |
474 break; | |
475 default: | |
476 break; | |
477 } | |
478 event->SetHandled(); | |
479 } else if (event->type() == ui::ET_GESTURE_TAP) { | |
458 EnsureVisible(); | 480 EnsureVisible(); |
459 window_->Show(); | 481 window_->Show(); |
460 wm::ActivateWindow(window_); | 482 wm::ActivateWindow(window_); |
461 } | 483 } |
462 } | 484 } |
463 | 485 |
464 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) { | 486 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) { |
465 if (event->type() == ui::ET_MOUSE_PRESSED && event->IsOnlyLeftMouseButton()) { | 487 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) { |
488 gfx::Point location(event->location()); | |
489 ::wm::ConvertPointToScreen(minimized_widget_->GetNativeWindow(), &location); | |
490 switch (event->type()) { | |
491 case ui::ET_MOUSE_PRESSED: | |
492 selector_item_->HandlePressEvent(location); | |
493 break; | |
494 case ui::ET_MOUSE_DRAGGED: | |
495 selector_item_->HandleDragEvent(location); | |
496 break; | |
497 case ui::ET_MOUSE_RELEASED: | |
498 selector_item_->HandleReleaseEvent(location); | |
499 break; | |
500 default: | |
501 break; | |
502 } | |
503 event->SetHandled(); | |
504 } else if (event->type() == ui::ET_MOUSE_PRESSED && | |
505 event->IsOnlyLeftMouseButton()) { | |
466 EnsureVisible(); | 506 EnsureVisible(); |
467 window_->Show(); | 507 window_->Show(); |
468 wm::ActivateWindow(window_); | 508 wm::ActivateWindow(window_); |
469 } | 509 } |
470 } | 510 } |
471 | 511 |
472 aura::Window* | 512 aura::Window* |
473 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const { | 513 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const { |
474 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr; | 514 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr; |
475 } | 515 } |
(...skipping 23 matching lines...) Expand all Loading... | |
499 // In unit tests, the content view can have empty size. | 539 // In unit tests, the content view can have empty size. |
500 if (!preferred.IsEmpty()) { | 540 if (!preferred.IsEmpty()) { |
501 int inset = bounds.height() - preferred.height(); | 541 int inset = bounds.height() - preferred.height(); |
502 bounds.Inset(0, 0, 0, inset); | 542 bounds.Inset(0, 0, 0, inset); |
503 } | 543 } |
504 minimized_widget_->SetBounds(bounds); | 544 minimized_widget_->SetBounds(bounds); |
505 minimized_widget_->Show(); | 545 minimized_widget_->Show(); |
506 } | 546 } |
507 | 547 |
508 } // namespace ash | 548 } // namespace ash |
OLD | NEW |