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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 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/shelf/shelf_view_unittest.cc ('k') | base/BUILD.gn » ('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/wm/overview/window_grid.h" 5 #include "ash/wm/overview/window_grid.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/ash_switches.h" 12 #include "ash/ash_switches.h"
13 #include "ash/screen_util.h" 13 #include "ash/screen_util.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/wm/overview/scoped_transform_overview_window.h" 16 #include "ash/wm/overview/scoped_transform_overview_window.h"
17 #include "ash/wm/overview/window_selector.h" 17 #include "ash/wm/overview/window_selector.h"
18 #include "ash/wm/overview/window_selector_item.h" 18 #include "ash/wm/overview/window_selector_item.h"
19 #include "ash/wm/window_state.h" 19 #include "ash/wm/window_state.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "base/i18n/string_search.h" 21 #include "base/i18n/string_search.h"
22 #include "base/memory/scoped_vector.h" 22 #include "base/memory/scoped_vector.h"
23 #include "third_party/skia/include/core/SkColor.h" 23 #include "third_party/skia/include/core/SkColor.h"
24 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
25 #include "ui/compositor/layer_animation_observer.h" 25 #include "ui/compositor/layer_animation_observer.h"
26 #include "ui/compositor/scoped_layer_animation_settings.h" 26 #include "ui/compositor/scoped_layer_animation_settings.h"
27 #include "ui/gfx/animation/tween.h" 27 #include "ui/gfx/animation/tween.h"
28 #include "ui/gfx/geometry/vector2d.h" 28 #include "ui/gfx/geometry/vector2d.h"
29 #include "ui/views/background.h" 29 #include "ui/views/background.h"
30 #include "ui/views/border.h"
30 #include "ui/views/view.h" 31 #include "ui/views/view.h"
31 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
32 #include "ui/wm/core/window_animations.h" 33 #include "ui/wm/core/window_animations.h"
33 34
34 namespace ash { 35 namespace ash {
35 namespace { 36 namespace {
36 37
37 typedef std::vector<aura::Window*> Windows; 38 typedef std::vector<aura::Window*> Windows;
38 39
39 // An observer which holds onto the passed widget until the animation is 40 // An observer which holds onto the passed widget until the animation is
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // area of them based on the number of window_list. 86 // area of them based on the number of window_list.
86 const float kCardAspectRatio = 4.0f / 3.0f; 87 const float kCardAspectRatio = 4.0f / 3.0f;
87 88
88 // The minimum number of cards along the major axis (i.e. horizontally on a 89 // The minimum number of cards along the major axis (i.e. horizontally on a
89 // landscape orientation). 90 // landscape orientation).
90 const int kMinCardsMajor = 3; 91 const int kMinCardsMajor = 3;
91 92
92 const int kOverviewSelectorTransitionMilliseconds = 100; 93 const int kOverviewSelectorTransitionMilliseconds = 100;
93 94
94 // The color and opacity of the overview selector. 95 // The color and opacity of the overview selector.
95 const SkColor kWindowOverviewSelectionColor = SK_ColorBLACK; 96 const SkColor kWindowSelectionColor = SkColorSetARGB(128, 0, 0, 0);
96 const unsigned char kWindowOverviewSelectorOpacity = 128; 97 const SkColor kWindowSelectionBorderColor = SkColorSetARGB(38, 255, 255, 255);
98 const int kWindowSelectionBorderThickness = 2;
97 99
98 // The minimum amount of spacing between the bottom of the text filtering 100 // The minimum amount of spacing between the bottom of the text filtering
99 // text field and the top of the selection widget on the first row of items. 101 // text field and the top of the selection widget on the first row of items.
100 const int kTextFilterBottomMargin = 5; 102 const int kTextFilterBottomMargin = 5;
101 103
102 // Returns the vector for the fade in animation. 104 // Returns the vector for the fade in animation.
103 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, 105 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction,
104 const gfx::Rect& bounds) { 106 const gfx::Rect& bounds) {
105 gfx::Vector2d vector; 107 gfx::Vector2d vector;
106 switch (direction) { 108 switch (direction) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 selection_widget_->Init(params); 363 selection_widget_->Init(params);
362 // Disable the "bounce in" animation when showing the window. 364 // Disable the "bounce in" animation when showing the window.
363 ::wm::SetWindowVisibilityAnimationTransition( 365 ::wm::SetWindowVisibilityAnimationTransition(
364 selection_widget_->GetNativeWindow(), ::wm::ANIMATE_NONE); 366 selection_widget_->GetNativeWindow(), ::wm::ANIMATE_NONE);
365 // The selection widget should not activate the shelf when passing under it. 367 // The selection widget should not activate the shelf when passing under it.
366 wm::GetWindowState(selection_widget_->GetNativeWindow())-> 368 wm::GetWindowState(selection_widget_->GetNativeWindow())->
367 set_ignored_by_shelf(true); 369 set_ignored_by_shelf(true);
368 370
369 views::View* content_view = new views::View; 371 views::View* content_view = new views::View;
370 content_view->set_background( 372 content_view->set_background(
371 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); 373 views::Background::CreateSolidBackground(kWindowSelectionColor));
374 content_view->SetBorder(views::Border::CreateSolidBorder(
375 kWindowSelectionBorderThickness, kWindowSelectionBorderColor));
372 selection_widget_->SetContentsView(content_view); 376 selection_widget_->SetContentsView(content_view);
373 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( 377 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom(
374 selection_widget_->GetNativeWindow()); 378 selection_widget_->GetNativeWindow());
375 selection_widget_->Show(); 379 selection_widget_->Show();
376 // New selection widget starts with 0 opacity and then fades in. 380 // New selection widget starts with 0 opacity and then fades in.
377 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0); 381 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0);
378 382
379 const gfx::Rect target_bounds = SelectedWindow()->target_bounds(); 383 const gfx::Rect target_bounds = SelectedWindow()->target_bounds();
380 gfx::Vector2d fade_out_direction = 384 gfx::Vector2d fade_out_direction =
381 GetSlideVectorForFadeIn(direction, target_bounds); 385 GetSlideVectorForFadeIn(direction, target_bounds);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 void WindowGrid::MoveSelectionWidgetToTarget(bool animate) { 435 void WindowGrid::MoveSelectionWidgetToTarget(bool animate) {
432 if (animate) { 436 if (animate) {
433 ui::ScopedLayerAnimationSettings animation_settings( 437 ui::ScopedLayerAnimationSettings animation_settings(
434 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); 438 selection_widget_->GetNativeWindow()->layer()->GetAnimator());
435 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 439 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
436 kOverviewSelectorTransitionMilliseconds)); 440 kOverviewSelectorTransitionMilliseconds));
437 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); 441 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN);
438 animation_settings.SetPreemptionStrategy( 442 animation_settings.SetPreemptionStrategy(
439 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 443 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
440 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 444 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
441 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); 445 selection_widget_->SetOpacity(255);
442 return; 446 return;
443 } 447 }
444 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 448 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
445 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); 449 selection_widget_->SetOpacity(255);
446 } 450 }
447 451
448 } // namespace ash 452 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698