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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.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_app.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/launcher/launcher.h" 10 #include "ash/launcher/launcher.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 ash::LauncherID ChromeLauncherControllerPerApp::CreateAppLauncherItem( 324 ash::LauncherID ChromeLauncherControllerPerApp::CreateAppLauncherItem(
325 LauncherItemController* controller, 325 LauncherItemController* controller,
326 const std::string& app_id, 326 const std::string& app_id,
327 ash::LauncherItemStatus status) { 327 ash::LauncherItemStatus status) {
328 CHECK(controller); 328 CHECK(controller);
329 return InsertAppLauncherItem(controller, 329 return InsertAppLauncherItem(controller,
330 app_id, 330 app_id,
331 status, 331 status,
332 model_->item_count(), 332 ash::LauncherModel::kAutomaticIndex,
333 controller->GetLauncherItemType()); 333 controller->GetLauncherItemType());
334 } 334 }
335 335
336 void ChromeLauncherControllerPerApp::SetItemStatus( 336 void ChromeLauncherControllerPerApp::SetItemStatus(
337 ash::LauncherID id, 337 ash::LauncherID id,
338 ash::LauncherItemStatus status) { 338 ash::LauncherItemStatus status) {
339 int index = model_->ItemIndexByID(id); 339 int index = model_->ItemIndexByID(id);
340 // Since ordinary browser windows are not registered, we might get a negative 340 // Since ordinary browser windows are not registered, we might get a negative
341 // index here. 341 // index here.
342 if (index >= 0) { 342 if (index >= 0) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 type == ash::TYPE_PLATFORM_APP || 452 type == ash::TYPE_PLATFORM_APP ||
453 type == ash::TYPE_WINDOWED_APP) && 453 type == ash::TYPE_WINDOWED_APP) &&
454 CanPin()); 454 CanPin());
455 } 455 }
456 456
457 void ChromeLauncherControllerPerApp::LockV1AppWithID( 457 void ChromeLauncherControllerPerApp::LockV1AppWithID(
458 const std::string& app_id) { 458 const std::string& app_id) {
459 ash::LauncherID id = GetLauncherIDForAppID(app_id); 459 ash::LauncherID id = GetLauncherIDForAppID(app_id);
460 if (!IsPinned(id) && !IsWindowedAppInLauncher(app_id)) { 460 if (!IsPinned(id) && !IsWindowedAppInLauncher(app_id)) {
461 CreateAppShortcutLauncherItemWithType(app_id, 461 CreateAppShortcutLauncherItemWithType(app_id,
462 model_->item_count(), 462 ash::LauncherModel::kAutomaticIndex,
463 ash::TYPE_WINDOWED_APP); 463 ash::TYPE_WINDOWED_APP);
464 id = GetLauncherIDForAppID(app_id); 464 id = GetLauncherIDForAppID(app_id);
465 } 465 }
466 CHECK(id); 466 CHECK(id);
467 id_to_item_controller_map_[id]->lock(); 467 id_to_item_controller_map_[id]->lock();
468 } 468 }
469 469
470 void ChromeLauncherControllerPerApp::UnlockV1AppWithID( 470 void ChromeLauncherControllerPerApp::UnlockV1AppWithID(
471 const std::string& app_id) { 471 const std::string& app_id) {
472 ash::LauncherID id = GetLauncherIDForAppID(app_id); 472 ash::LauncherID id = GetLauncherIDForAppID(app_id);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 // If there is an item, do nothing and return. 1334 // If there is an item, do nothing and return.
1335 if (IsAppPinned(app_id)) 1335 if (IsAppPinned(app_id))
1336 return; 1336 return;
1337 1337
1338 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id); 1338 ash::LauncherID launcher_id = GetLauncherIDForAppID(app_id);
1339 if (launcher_id) { 1339 if (launcher_id) {
1340 // App item exists, pin it 1340 // App item exists, pin it
1341 Pin(launcher_id); 1341 Pin(launcher_id);
1342 } else { 1342 } else {
1343 // Otherwise, create a shortcut item for it. 1343 // Otherwise, create a shortcut item for it.
1344 CreateAppShortcutLauncherItem(app_id, model_->item_count()); 1344 CreateAppShortcutLauncherItem(app_id, ash::LauncherModel::kAutomaticIndex);
1345 if (CanPin()) 1345 if (CanPin())
1346 PersistPinnedState(); 1346 PersistPinnedState();
1347 } 1347 }
1348 } 1348 }
1349 1349
1350 void ChromeLauncherControllerPerApp::DoUnpinAppsWithID( 1350 void ChromeLauncherControllerPerApp::DoUnpinAppsWithID(
1351 const std::string& app_id) { 1351 const std::string& app_id) {
1352 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin(); 1352 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin();
1353 i != id_to_item_controller_map_.end(); ) { 1353 i != id_to_item_controller_map_.end(); ) {
1354 IDToItemControllerMap::iterator current(i); 1354 IDToItemControllerMap::iterator current(i);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 browser_to_close.pop_back(); 1667 browser_to_close.pop_back();
1668 } 1668 }
1669 } 1669 }
1670 1670
1671 void 1671 void
1672 ChromeLauncherControllerPerApp::MoveItemWithoutPinnedStateChangeNotification( 1672 ChromeLauncherControllerPerApp::MoveItemWithoutPinnedStateChangeNotification(
1673 int source_index, int target_index) { 1673 int source_index, int target_index) {
1674 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); 1674 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true);
1675 model_->Move(source_index, target_index); 1675 model_->Move(source_index, target_index);
1676 } 1676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698