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

Unified Diff: ash/shelf/shelf_navigator.cc

Issue 2169653002: mash: Move shelf_navigator.* to //ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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
« no previous file with comments | « ash/shelf/shelf_navigator.h ('k') | ash/shelf/shelf_navigator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_navigator.cc
diff --git a/ash/shelf/shelf_navigator.cc b/ash/shelf/shelf_navigator.cc
deleted file mode 100644
index 9bbb843826dd277bdd2b9149f42b702f70ac1ca0..0000000000000000000000000000000000000000
--- a/ash/shelf/shelf_navigator.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/shelf/shelf_navigator.h"
-
-#include "ash/common/shelf/shelf_model.h"
-
-namespace ash {
-
-namespace {
-
-// Returns true if accelerator processing should skip the shelf item with the
-// specified type.
-bool ShouldSkip(ShelfItemType type) {
- return type == TYPE_APP_LIST || type == TYPE_BROWSER_SHORTCUT ||
- type == TYPE_APP_SHORTCUT || type == TYPE_WINDOWED_APP;
-}
-
-} // namespace
-
-int GetNextActivatedItemIndex(const ShelfModel& model,
- CycleDirection direction) {
- const ShelfItems& items = model.items();
- int item_count = model.item_count();
- int current_index = -1;
- int first_running = -1;
-
- for (int i = 0; i < item_count; ++i) {
- const ShelfItem& item = items[i];
- if (ShouldSkip(item.type))
- continue;
-
- if (item.status == STATUS_RUNNING && first_running < 0)
- first_running = i;
-
- if (item.status == STATUS_ACTIVE) {
- current_index = i;
- break;
- }
- }
-
- // If nothing is active, try to active the first running item.
- if (current_index < 0) {
- if (first_running >= 0)
- return first_running;
- else
- return -1;
- }
-
- int step = (direction == CYCLE_FORWARD) ? 1 : -1;
-
- // Find the next item and activate it.
- for (int i = (current_index + step + item_count) % item_count;
- i != current_index; i = (i + step + item_count) % item_count) {
- const ShelfItem& item = items[i];
- if (ShouldSkip(item.type))
- continue;
-
- // Skip already active item.
- if (item.status == STATUS_ACTIVE)
- continue;
-
- return i;
- }
-
- return -1;
-}
-
-} // namespace ash
« no previous file with comments | « ash/shelf/shelf_navigator.h ('k') | ash/shelf/shelf_navigator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698