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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc

Issue 17673004: Insert panel icons on the left of other panel icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix test assertions. Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 model_->Add(item); 377 model_->Add(item);
378 return id; 378 return id;
379 } 379 }
380 380
381 ash::LauncherID ChromeLauncherControllerPerBrowser::CreateAppLauncherItem( 381 ash::LauncherID ChromeLauncherControllerPerBrowser::CreateAppLauncherItem(
382 LauncherItemController* controller, 382 LauncherItemController* controller,
383 const std::string& app_id, 383 const std::string& app_id,
384 ash::LauncherItemStatus status) { 384 ash::LauncherItemStatus status) {
385 DCHECK(controller); 385 DCHECK(controller);
386 return InsertAppLauncherItem(controller, app_id, status, 386 return InsertAppLauncherItem(controller, app_id, status,
387 model_->item_count()); 387 ash::LauncherModel::kAutomaticIndex);
388 } 388 }
389 389
390 void ChromeLauncherControllerPerBrowser::SetItemStatus( 390 void ChromeLauncherControllerPerBrowser::SetItemStatus(
391 ash::LauncherID id, 391 ash::LauncherID id,
392 ash::LauncherItemStatus status) { 392 ash::LauncherItemStatus status) {
393 int index = model_->ItemIndexByID(id); 393 int index = model_->ItemIndexByID(id);
394 DCHECK_GE(index, 0); 394 DCHECK_GE(index, 0);
395 ash::LauncherItem item = model_->items()[index]; 395 ash::LauncherItem item = model_->items()[index];
396 item.status = status; 396 item.status = status;
397 model_->Set(index, item); 397 model_->Set(index, item);
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 // If there is an item, do nothing and return. 1172 // If there is an item, do nothing and return.
1173 if (IsAppPinned(app_id)) 1173 if (IsAppPinned(app_id))
1174 return; 1174 return;
1175 1175
1176 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id); 1176 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id);
1177 if (launcher_id) { 1177 if (launcher_id) {
1178 // App item exists, pin it 1178 // App item exists, pin it
1179 Pin(launcher_id); 1179 Pin(launcher_id);
1180 } else { 1180 } else {
1181 // Otherwise, create a shortcut item for it. 1181 // Otherwise, create a shortcut item for it.
1182 CreateAppShortcutLauncherItem(app_id, model_->item_count()); 1182 CreateAppShortcutLauncherItem(app_id, ash::LauncherModel::kAutomaticIndex);
1183 if (CanPin()) 1183 if (CanPin())
1184 PersistPinnedState(); 1184 PersistPinnedState();
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 void ChromeLauncherControllerPerBrowser::DoUnpinAppsWithID( 1188 void ChromeLauncherControllerPerBrowser::DoUnpinAppsWithID(
1189 const std::string& app_id) { 1189 const std::string& app_id) {
1190 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin(); 1190 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin();
1191 i != id_to_item_controller_map_.end(); ) { 1191 i != id_to_item_controller_map_.end(); ) {
1192 IDToItemControllerMap::iterator current(i); 1192 IDToItemControllerMap::iterator current(i);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 ash::LauncherID id) { 1457 ash::LauncherID id) {
1458 return id_to_item_controller_map_[id]->app_id(); 1458 return id_to_item_controller_map_[id]->app_id();
1459 } 1459 }
1460 1460
1461 void ChromeLauncherControllerPerBrowser:: 1461 void ChromeLauncherControllerPerBrowser::
1462 MoveItemWithoutPinnedStateChangeNotification(int source_index, 1462 MoveItemWithoutPinnedStateChangeNotification(int source_index,
1463 int target_index) { 1463 int target_index) {
1464 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); 1464 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true);
1465 model_->Move(source_index, target_index); 1465 model_->Move(source_index, target_index);
1466 } 1466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698