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

Side by Side Diff: ash/wm/overview/scoped_transform_overview_window.cc

Issue 2955203002: Cros Tablet Window management - Split Screen part II (Closed)
Patch Set: Fix the failed ash_unittest. Created 3 years, 5 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
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.h ('k') | ash/wm/overview/window_grid.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 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/wm/overview/scoped_overview_animation_settings.h" 10 #include "ash/wm/overview/scoped_overview_animation_settings.h"
11 #include "ash/wm/overview/window_selector_item.h" 11 #include "ash/wm/overview/window_selector_item.h"
12 #include "ash/wm/splitview/split_view_controller.h"
12 #include "ash/wm/window_mirror_view.h" 13 #include "ash/wm/window_mirror_view.h"
13 #include "ash/wm/window_state.h" 14 #include "ash/wm/window_state.h"
14 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
21 #include "ui/compositor/layer.h" 22 #include "ui/compositor/layer.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 TransientDescendantIteratorRange GetTransientTreeIterator( 159 TransientDescendantIteratorRange GetTransientTreeIterator(
159 aura::Window* window) { 160 aura::Window* window) {
160 return TransientDescendantIteratorRange( 161 return TransientDescendantIteratorRange(
161 TransientDescendantIterator(GetTransientRoot(window))); 162 TransientDescendantIterator(GetTransientRoot(window)));
162 } 163 }
163 164
164 } // namespace 165 } // namespace
165 166
166 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( 167 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(
168 WindowSelectorItem* selector_item,
167 aura::Window* window) 169 aura::Window* window)
168 : window_(window), 170 : selector_item_(selector_item),
171 window_(window),
169 determined_original_window_shape_(false), 172 determined_original_window_shape_(false),
170 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()), 173 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()),
171 overview_started_(false), 174 overview_started_(false),
172 original_transform_(window->layer()->GetTargetTransform()), 175 original_transform_(window->layer()->GetTargetTransform()),
173 original_opacity_(window->layer()->GetTargetOpacity()), 176 original_opacity_(window->layer()->GetTargetOpacity()),
174 weak_ptr_factory_(this) {} 177 weak_ptr_factory_(this) {}
175 178
176 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} 179 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {}
177 180
178 void ScopedTransformOverviewWindow::RestoreWindow() { 181 void ScopedTransformOverviewWindow::RestoreWindow() {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (minimized_widget_) 452 if (minimized_widget_)
450 return GetOverviewWindowForMinimizedState(); 453 return GetOverviewWindowForMinimizedState();
451 return window_; 454 return window_;
452 } 455 }
453 456
454 void ScopedTransformOverviewWindow::EnsureVisible() { 457 void ScopedTransformOverviewWindow::EnsureVisible() {
455 original_opacity_ = 1.f; 458 original_opacity_ = 1.f;
456 } 459 }
457 460
458 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) { 461 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) {
459 if (event->type() == ui::ET_GESTURE_TAP) { 462 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) {
463 gfx::Point location(event->location());
464 ::wm::ConvertPointToScreen(minimized_widget_->GetNativeWindow(), &location);
465 switch (event->type()) {
466 case ui::ET_GESTURE_SCROLL_BEGIN:
467 case ui::ET_GESTURE_TAP_DOWN:
468 selector_item_->HandlePressEvent(location);
469 break;
470 case ui::ET_GESTURE_SCROLL_UPDATE:
471 selector_item_->HandleDragEvent(location);
472 break;
473 case ui::ET_GESTURE_END:
474 selector_item_->HandleReleaseEvent(location);
475 break;
476 default:
477 break;
478 }
479 event->SetHandled();
480 } else if (event->type() == ui::ET_GESTURE_TAP) {
460 EnsureVisible(); 481 EnsureVisible();
461 window_->Show(); 482 window_->Show();
462 wm::ActivateWindow(window_); 483 wm::ActivateWindow(window_);
463 } 484 }
464 } 485 }
465 486
466 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) { 487 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) {
467 if (event->type() == ui::ET_MOUSE_PRESSED && event->IsOnlyLeftMouseButton()) { 488 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) {
489 gfx::Point location(event->location());
490 ::wm::ConvertPointToScreen(minimized_widget_->GetNativeWindow(), &location);
491 switch (event->type()) {
492 case ui::ET_MOUSE_PRESSED:
493 selector_item_->HandlePressEvent(location);
494 break;
495 case ui::ET_MOUSE_DRAGGED:
496 selector_item_->HandleDragEvent(location);
497 break;
498 case ui::ET_MOUSE_RELEASED:
499 selector_item_->HandleReleaseEvent(location);
500 break;
501 default:
502 break;
503 }
504 event->SetHandled();
505 } else if (event->type() == ui::ET_MOUSE_PRESSED &&
506 event->IsOnlyLeftMouseButton()) {
468 EnsureVisible(); 507 EnsureVisible();
469 window_->Show(); 508 window_->Show();
470 wm::ActivateWindow(window_); 509 wm::ActivateWindow(window_);
471 } 510 }
472 } 511 }
473 512
474 aura::Window* 513 aura::Window*
475 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const { 514 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const {
476 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr; 515 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr;
477 } 516 }
(...skipping 21 matching lines...) Expand all
499 // In unit tests, the content view can have empty size. 538 // In unit tests, the content view can have empty size.
500 if (!preferred.IsEmpty()) { 539 if (!preferred.IsEmpty()) {
501 int inset = bounds.height() - preferred.height(); 540 int inset = bounds.height() - preferred.height();
502 bounds.Inset(0, 0, 0, inset); 541 bounds.Inset(0, 0, 0, inset);
503 } 542 }
504 minimized_widget_->SetBounds(bounds); 543 minimized_widget_->SetBounds(bounds);
505 minimized_widget_->Show(); 544 minimized_widget_->Show();
506 } 545 }
507 546
508 } // namespace ash 547 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.h ('k') | ash/wm/overview/window_grid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698