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

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

Issue 403493006: Visual improvements to text filtering in Ash overview mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change to screen dimensions in test Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/overview/window_selector.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 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 "ash/ash_switches.h"
7 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
10 #include "ash/wm/overview/scoped_transform_overview_window.h" 11 #include "ash/wm/overview/scoped_transform_overview_window.h"
11 #include "ash/wm/overview/window_selector.h" 12 #include "ash/wm/overview/window_selector.h"
12 #include "ash/wm/overview/window_selector_item.h" 13 #include "ash/wm/overview/window_selector_item.h"
13 #include "ash/wm/overview/window_selector_panels.h" 14 #include "ash/wm/overview/window_selector_panels.h"
14 #include "ash/wm/overview/window_selector_window.h" 15 #include "ash/wm/overview/window_selector_window.h"
15 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
17 #include "base/command_line.h"
16 #include "base/i18n/string_search.h" 18 #include "base/i18n/string_search.h"
17 #include "base/memory/scoped_vector.h" 19 #include "base/memory/scoped_vector.h"
18 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
19 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
20 #include "ui/compositor/layer_animation_observer.h" 22 #include "ui/compositor/layer_animation_observer.h"
21 #include "ui/compositor/scoped_layer_animation_settings.h" 23 #include "ui/compositor/scoped_layer_animation_settings.h"
22 #include "ui/gfx/animation/tween.h" 24 #include "ui/gfx/animation/tween.h"
23 #include "ui/gfx/vector2d.h" 25 #include "ui/gfx/vector2d.h"
24 #include "ui/views/background.h" 26 #include "ui/views/background.h"
25 #include "ui/views/view.h" 27 #include "ui/views/view.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // The minimum number of cards along the major axis (i.e. horizontally on a 97 // The minimum number of cards along the major axis (i.e. horizontally on a
96 // landscape orientation). 98 // landscape orientation).
97 const int kMinCardsMajor = 3; 99 const int kMinCardsMajor = 3;
98 100
99 const int kOverviewSelectorTransitionMilliseconds = 100; 101 const int kOverviewSelectorTransitionMilliseconds = 100;
100 102
101 // The color and opacity of the overview selector. 103 // The color and opacity of the overview selector.
102 const SkColor kWindowOverviewSelectionColor = SK_ColorBLACK; 104 const SkColor kWindowOverviewSelectionColor = SK_ColorBLACK;
103 const unsigned char kWindowOverviewSelectorOpacity = 128; 105 const unsigned char kWindowOverviewSelectorOpacity = 128;
104 106
107 // The minimum amount of spacing between the bottom of the text filtering
108 // text field and the top of the selection widget on the first row of items.
109 const int kTextFilterBottomMargin = 5;
110
105 // Returns the vector for the fade in animation. 111 // Returns the vector for the fade in animation.
106 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, 112 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction,
107 const gfx::Rect& bounds) { 113 const gfx::Rect& bounds) {
108 gfx::Vector2d vector; 114 gfx::Vector2d vector;
109 switch (direction) { 115 switch (direction) {
110 case WindowSelector::DOWN: 116 case WindowSelector::DOWN:
111 vector.set_y(bounds.width()); 117 vector.set_y(bounds.width());
112 break; 118 break;
113 case WindowSelector::RIGHT: 119 case WindowSelector::RIGHT:
114 vector.set_x(bounds.height()); 120 vector.set_x(bounds.height());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 177
172 void WindowGrid::PositionWindows(bool animate) { 178 void WindowGrid::PositionWindows(bool animate) {
173 CHECK(!window_list_.empty()); 179 CHECK(!window_list_.empty());
174 180
175 gfx::Size window_size; 181 gfx::Size window_size;
176 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen( 182 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen(
177 root_window_, 183 root_window_,
178 ScreenUtil::GetDisplayWorkAreaBoundsInParent( 184 ScreenUtil::GetDisplayWorkAreaBoundsInParent(
179 Shell::GetContainer(root_window_, kShellWindowId_DefaultContainer))); 185 Shell::GetContainer(root_window_, kShellWindowId_DefaultContainer)));
180 186
187 // If the text filtering feature is enabled, reserve space at the top for the
188 // text filtering textbox to appear.
189 if (!CommandLine::ForCurrentProcess()->HasSwitch(
190 switches::kAshDisableTextFilteringInOverviewMode)) {
191 total_bounds.Inset(
192 0,
193 WindowSelector::kTextFilterBottomEdge + kTextFilterBottomMargin,
194 0,
195 0);
196 }
197
181 // Find the minimum number of windows per row that will fit all of the 198 // Find the minimum number of windows per row that will fit all of the
182 // windows on screen. 199 // windows on screen.
183 num_columns_ = std::max( 200 num_columns_ = std::max(
184 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, 201 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1,
185 static_cast<int>(ceil(sqrt(total_bounds.width() * window_list_.size() / 202 static_cast<int>(ceil(sqrt(total_bounds.width() * window_list_.size() /
186 (kCardAspectRatio * total_bounds.height()))))); 203 (kCardAspectRatio * total_bounds.height())))));
187 int num_rows = ((window_list_.size() + num_columns_ - 1) / num_columns_); 204 int num_rows = ((window_list_.size() + num_columns_ - 1) / num_columns_);
188 window_size.set_width(std::min( 205 window_size.set_width(std::min(
189 static_cast<int>(total_bounds.width() / num_columns_), 206 static_cast<int>(total_bounds.width() / num_columns_),
190 static_cast<int>(total_bounds.height() * kCardAspectRatio / num_rows))); 207 static_cast<int>(total_bounds.height() * kCardAspectRatio / num_rows)));
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 471 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
455 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 472 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
456 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); 473 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity);
457 return; 474 return;
458 } 475 }
459 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 476 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
460 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity); 477 selection_widget_->SetOpacity(kWindowOverviewSelectorOpacity);
461 } 478 }
462 479
463 } // namespace ash 480 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/overview/window_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698