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

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

Issue 2978273002: Revert of Cros Tablet Window management - Split Screen part II (Closed)
Patch Set: 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"
13 #include "ash/wm/window_mirror_view.h" 12 #include "ash/wm/window_mirror_view.h"
14 #include "ash/wm/window_state.h" 13 #include "ash/wm/window_state.h"
15 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
16 #include "base/macros.h" 15 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
18 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
20 #include "ui/aura/client/aura_constants.h" 19 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
22 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 157
159 TransientDescendantIteratorRange GetTransientTreeIterator( 158 TransientDescendantIteratorRange GetTransientTreeIterator(
160 aura::Window* window) { 159 aura::Window* window) {
161 return TransientDescendantIteratorRange( 160 return TransientDescendantIteratorRange(
162 TransientDescendantIterator(GetTransientRoot(window))); 161 TransientDescendantIterator(GetTransientRoot(window)));
163 } 162 }
164 163
165 } // namespace 164 } // namespace
166 165
167 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow( 166 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(
168 WindowSelectorItem* selector_item,
169 aura::Window* window) 167 aura::Window* window)
170 : selector_item_(selector_item), 168 : window_(window),
171 window_(window),
172 determined_original_window_shape_(false), 169 determined_original_window_shape_(false),
173 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()), 170 ignored_by_shelf_(wm::GetWindowState(window)->ignored_by_shelf()),
174 overview_started_(false), 171 overview_started_(false),
175 original_transform_(window->layer()->GetTargetTransform()), 172 original_transform_(window->layer()->GetTargetTransform()),
176 original_opacity_(window->layer()->GetTargetOpacity()), 173 original_opacity_(window->layer()->GetTargetOpacity()),
177 weak_ptr_factory_(this) {} 174 weak_ptr_factory_(this) {}
178 175
179 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} 176 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {}
180 177
181 void ScopedTransformOverviewWindow::RestoreWindow() { 178 void ScopedTransformOverviewWindow::RestoreWindow() {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if (minimized_widget_) 449 if (minimized_widget_)
453 return GetOverviewWindowForMinimizedState(); 450 return GetOverviewWindowForMinimizedState();
454 return window_; 451 return window_;
455 } 452 }
456 453
457 void ScopedTransformOverviewWindow::EnsureVisible() { 454 void ScopedTransformOverviewWindow::EnsureVisible() {
458 original_opacity_ = 1.f; 455 original_opacity_ = 1.f;
459 } 456 }
460 457
461 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) { 458 void ScopedTransformOverviewWindow::OnGestureEvent(ui::GestureEvent* event) {
462 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) { 459 if (event->type() == ui::ET_GESTURE_TAP) {
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) {
481 EnsureVisible(); 460 EnsureVisible();
482 window_->Show(); 461 window_->Show();
483 wm::ActivateWindow(window_); 462 wm::ActivateWindow(window_);
484 } 463 }
485 } 464 }
486 465
487 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) { 466 void ScopedTransformOverviewWindow::OnMouseEvent(ui::MouseEvent* event) {
488 if (minimized_widget_ && SplitViewController::ShouldAllowSplitView()) { 467 if (event->type() == ui::ET_MOUSE_PRESSED && event->IsOnlyLeftMouseButton()) {
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()) {
507 EnsureVisible(); 468 EnsureVisible();
508 window_->Show(); 469 window_->Show();
509 wm::ActivateWindow(window_); 470 wm::ActivateWindow(window_);
510 } 471 }
511 } 472 }
512 473
513 aura::Window* 474 aura::Window*
514 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const { 475 ScopedTransformOverviewWindow::GetOverviewWindowForMinimizedState() const {
515 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr; 476 return minimized_widget_ ? minimized_widget_->GetNativeWindow() : nullptr;
516 } 477 }
(...skipping 21 matching lines...) Expand all
538 // In unit tests, the content view can have empty size. 499 // In unit tests, the content view can have empty size.
539 if (!preferred.IsEmpty()) { 500 if (!preferred.IsEmpty()) {
540 int inset = bounds.height() - preferred.height(); 501 int inset = bounds.height() - preferred.height();
541 bounds.Inset(0, 0, 0, inset); 502 bounds.Inset(0, 0, 0, inset);
542 } 503 }
543 minimized_widget_->SetBounds(bounds); 504 minimized_widget_->SetBounds(bounds);
544 minimized_widget_->Show(); 505 minimized_widget_->Show();
545 } 506 }
546 507
547 } // namespace ash 508 } // 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