| OLD | NEW |
| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 item.status = status; | 376 item.status = status; |
| 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 // Panels are inserted on the left so as not to push all existing panels over. |
| 387 model_->item_count()); | 387 int index = controller->GetLauncherItemType() == ash::TYPE_APP_PANEL ? |
| 388 0 : model_->item_count(); |
| 389 return InsertAppLauncherItem(controller, app_id, status, index); |
| 388 } | 390 } |
| 389 | 391 |
| 390 void ChromeLauncherControllerPerBrowser::SetItemStatus( | 392 void ChromeLauncherControllerPerBrowser::SetItemStatus( |
| 391 ash::LauncherID id, | 393 ash::LauncherID id, |
| 392 ash::LauncherItemStatus status) { | 394 ash::LauncherItemStatus status) { |
| 393 int index = model_->ItemIndexByID(id); | 395 int index = model_->ItemIndexByID(id); |
| 394 DCHECK_GE(index, 0); | 396 DCHECK_GE(index, 0); |
| 395 ash::LauncherItem item = model_->items()[index]; | 397 ash::LauncherItem item = model_->items()[index]; |
| 396 item.status = status; | 398 item.status = status; |
| 397 model_->Set(index, item); | 399 model_->Set(index, item); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 ash::LauncherID id) { | 1459 ash::LauncherID id) { |
| 1458 return id_to_item_controller_map_[id]->app_id(); | 1460 return id_to_item_controller_map_[id]->app_id(); |
| 1459 } | 1461 } |
| 1460 | 1462 |
| 1461 void ChromeLauncherControllerPerBrowser:: | 1463 void ChromeLauncherControllerPerBrowser:: |
| 1462 MoveItemWithoutPinnedStateChangeNotification(int source_index, | 1464 MoveItemWithoutPinnedStateChangeNotification(int source_index, |
| 1463 int target_index) { | 1465 int target_index) { |
| 1464 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); | 1466 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); |
| 1465 model_->Move(source_index, target_index); | 1467 model_->Move(source_index, target_index); |
| 1466 } | 1468 } |
| OLD | NEW |