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

Side by Side Diff: ash/common/wm/window_cycle_list.cc

Issue 2642273002: CrOS - Make it possible to Alt+Tab while dragging a tab (Closed)
Patch Set: fix tests Created 3 years, 11 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 | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/wm/window_cycle_list.h" 5 #include "ash/common/wm/window_cycle_list.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "ash/common/wm/mru_window_tracker.h" 10 #include "ash/common/wm/mru_window_tracker.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 AddChildView(highlight_view_); 255 AddChildView(highlight_view_);
256 AddChildView(mirror_container_); 256 AddChildView(mirror_container_);
257 } 257 }
258 258
259 ~WindowCycleView() override {} 259 ~WindowCycleView() override {}
260 260
261 void SetTargetWindow(WmWindow* target) { 261 void SetTargetWindow(WmWindow* target) {
262 target_window_ = target; 262 target_window_ = target;
263 if (GetWidget()) { 263 if (GetWidget()) {
264 Layout(); 264 Layout();
265 if (target_window_) { 265 if (target_window_)
266 // In the window destruction case, we may have already removed the
267 // focused view and hence not be the focused window. We should still
268 // always be active, though.
269 DCHECK_EQ(ash::WmShell::Get()->GetActiveWindow()->GetInternalWidget(),
270 GetWidget());
271 window_view_map_[target_window_]->RequestFocus(); 266 window_view_map_[target_window_]->RequestFocus();
272 }
273 } 267 }
274 } 268 }
275 269
276 void HandleWindowDestruction(WmWindow* destroying_window, 270 void HandleWindowDestruction(WmWindow* destroying_window,
277 WmWindow* new_target) { 271 WmWindow* new_target) {
278 auto view_iter = window_view_map_.find(destroying_window); 272 auto view_iter = window_view_map_.find(destroying_window);
279 views::View* preview = view_iter->second; 273 views::View* preview = view_iter->second;
280 views::View* parent = preview->parent(); 274 views::View* parent = preview->parent();
281 DCHECK_EQ(mirror_container_, parent); 275 DCHECK_EQ(mirror_container_, parent);
282 window_view_map_.erase(view_iter); 276 window_view_map_.erase(view_iter);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // never change). 341 // never change).
348 mirror_container_->layer()->SetAnimator( 342 mirror_container_->layer()->SetAnimator(
349 ui::LayerAnimator::CreateImplicitAnimator()); 343 ui::LayerAnimator::CreateImplicitAnimator());
350 // The selection highlight also animates all bounds changes and never 344 // The selection highlight also animates all bounds changes and never
351 // changes other animatable properties. 345 // changes other animatable properties.
352 highlight_view_->layer()->SetAnimator( 346 highlight_view_->layer()->SetAnimator(
353 ui::LayerAnimator::CreateImplicitAnimator()); 347 ui::LayerAnimator::CreateImplicitAnimator());
354 } 348 }
355 } 349 }
356 350
357 void OnMouseCaptureLost() override {
358 WmShell::Get()->window_cycle_controller()->CancelCycling();
359 }
360
361 void OnPaintBackground(gfx::Canvas* canvas) override { 351 void OnPaintBackground(gfx::Canvas* canvas) override {
362 // We can't set a bg on the mirror container itself because the highlight 352 // We can't set a bg on the mirror container itself because the highlight
363 // view needs to be on top of the bg but behind the target windows. 353 // view needs to be on top of the bg but behind the target windows.
364 const gfx::RectF shield_bounds(mirror_container_->bounds()); 354 const gfx::RectF shield_bounds(mirror_container_->bounds());
365 SkPaint paint; 355 SkPaint paint;
366 paint.setColor(SkColorSetA(SK_ColorBLACK, 0xE6)); 356 paint.setColor(SkColorSetA(SK_ColorBLACK, 0xE6));
367 paint.setStyle(SkPaint::kFill_Style); 357 paint.setStyle(SkPaint::kFill_Style);
368 float corner_radius = 0.f; 358 float corner_radius = 0.f;
369 if (shield_bounds.width() < width()) { 359 if (shield_bounds.width() < width()) {
370 paint.setAntiAlias(true); 360 paint.setAntiAlias(true);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 gfx::Rect widget_rect = root_window->GetDisplayNearestWindow().bounds(); 535 gfx::Rect widget_rect = root_window->GetDisplayNearestWindow().bounds();
546 const int widget_height = cycle_view_->GetPreferredSize().height(); 536 const int widget_height = cycle_view_->GetPreferredSize().height();
547 widget_rect.set_y(widget_rect.y() + 537 widget_rect.set_y(widget_rect.y() +
548 (widget_rect.height() - widget_height) / 2); 538 (widget_rect.height() - widget_height) / 2);
549 widget_rect.set_height(widget_height); 539 widget_rect.set_height(widget_height);
550 params.bounds = widget_rect; 540 params.bounds = widget_rect;
551 widget->Init(params); 541 widget->Init(params);
552 542
553 screen_observer_.Add(display::Screen::GetScreen()); 543 screen_observer_.Add(display::Screen::GetScreen());
554 widget->Show(); 544 widget->Show();
555 widget->SetCapture(cycle_view_);
556 widget->set_auto_release_capture(false);
557 cycle_ui_widget_ = widget; 545 cycle_ui_widget_ = widget;
558 } 546 }
559 547
560 } // namespace ash 548 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698