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

Unified Diff: ash/wm/overview/window_grid.cc

Issue 358553004: Added text filtering to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unittest Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/overview/window_grid.cc
diff --git a/ash/wm/overview/window_grid.cc b/ash/wm/overview/window_grid.cc
index 99ea37c2d1e54056e20674b2f1366eb468a595f8..04cb59377573956dcb4c8aa8d3a3561b618082f9 100644
--- a/ash/wm/overview/window_grid.cc
+++ b/ash/wm/overview/window_grid.cc
@@ -13,6 +13,7 @@
#include "ash/wm/overview/window_selector_panels.h"
#include "ash/wm/overview/window_selector_window.h"
#include "ash/wm/window_state.h"
+#include "base/i18n/string_search.h"
#include "base/memory/scoped_vector.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/window.h"
@@ -197,6 +198,7 @@ void WindowGrid::PositionWindows(bool animate) {
(total_bounds.width() - num_columns_ * window_size.width())) / 2;
int y_offset = total_bounds.y() + (total_bounds.height() -
num_rows * window_size.height()) / 2;
+
for (size_t i = 0; i < window_list_.size(); ++i) {
gfx::Transform transform;
int column = i % num_columns_;
@@ -218,7 +220,7 @@ void WindowGrid::PositionWindows(bool animate) {
MoveSelectionWidgetToTarget(animate);
}
-bool WindowGrid::Move(WindowSelector::Direction direction) {
+bool WindowGrid::Move(WindowSelector::Direction direction, bool animate) {
bool recreate_selection_widget = false;
bool out_of_bounds = false;
if (!selection_widget_) {
@@ -235,7 +237,8 @@ bool WindowGrid::Move(WindowSelector::Direction direction) {
selected_index_ = 0;
break;
}
- } else {
+ }
+ while (SelectedWindow()->dimmed() || selection_widget_) {
switch (direction) {
case WindowSelector::RIGHT:
if (selected_index_ >= window_list_.size() - 1)
@@ -272,9 +275,13 @@ bool WindowGrid::Move(WindowSelector::Direction direction) {
}
break;
}
+ // Exit the loop if we broke free from the grid or found an active item.
+ if (out_of_bounds || !SelectedWindow()->dimmed())
+ break;
}
- MoveSelectionWidget(direction, recreate_selection_widget, out_of_bounds);
+ MoveSelectionWidget(direction, recreate_selection_widget,
+ out_of_bounds, animate);
return out_of_bounds;
}
@@ -289,6 +296,20 @@ bool WindowGrid::Contains(const aura::Window* window) const {
window_list_.end();
}
+void WindowGrid::FilterItems(const base::string16& pattern) {
+ base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents finder(pattern);
+ for (ScopedVector<WindowSelectorItem>::iterator iter = window_list_.begin();
+ iter != window_list_.end(); iter++) {
+ if (finder.Search((*iter)->SelectionWindow()->title(), NULL, NULL)) {
+ (*iter)->SetDimmed(false);
+ } else {
+ (*iter)->SetDimmed(true);
+ if (selection_widget_ && SelectedWindow() == *iter)
+ selection_widget_.reset();
+ }
+ }
+}
+
void WindowGrid::OnWindowDestroying(aura::Window* window) {
window->RemoveObserver(this);
observed_windows_.erase(window);
@@ -383,7 +404,8 @@ void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) {
void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction,
bool recreate_selection_widget,
- bool out_of_bounds) {
+ bool out_of_bounds,
+ bool animate) {
// If the selection widget is already active, fade it out in the selection
// direction.
if (selection_widget_ && (recreate_selection_widget || out_of_bounds)) {
@@ -420,7 +442,7 @@ void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction,
SelectedWindow()->SendFocusAlert();
// The selection widget is moved to the newly selected item in the same
// grid.
- MoveSelectionWidgetToTarget(true);
+ MoveSelectionWidgetToTarget(animate);
}
void WindowGrid::MoveSelectionWidgetToTarget(bool animate) {

Powered by Google App Engine
This is Rietveld 408576698