| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 const std::string& id, | 622 const std::string& id, |
| 623 const gfx::ImageSkia& image) { | 623 const gfx::ImageSkia& image) { |
| 624 // TODO: need to get this working for shortcuts. | 624 // TODO: need to get this working for shortcuts. |
| 625 | 625 |
| 626 for (IDToItemControllerMap::const_iterator i = | 626 for (IDToItemControllerMap::const_iterator i = |
| 627 id_to_item_controller_map_.begin(); | 627 id_to_item_controller_map_.begin(); |
| 628 i != id_to_item_controller_map_.end(); ++i) { | 628 i != id_to_item_controller_map_.end(); ++i) { |
| 629 if (i->second->app_id() != id) | 629 if (i->second->app_id() != id) |
| 630 continue; | 630 continue; |
| 631 | 631 |
| 632 // Panel items may share the same app_id as the app that created them, | |
| 633 // but they set their icon image in | |
| 634 // BrowserLauncherItemController::UpdateLauncher(), so do not set panel | |
| 635 // images here. | |
| 636 if (i->second->type() == LauncherItemController::TYPE_EXTENSION_PANEL) | |
| 637 continue; | |
| 638 | |
| 639 int index = model_->ItemIndexByID(i->first); | 632 int index = model_->ItemIndexByID(i->first); |
| 640 ash::LauncherItem item = model_->items()[index]; | 633 ash::LauncherItem item = model_->items()[index]; |
| 641 item.image = image; | 634 item.image = image; |
| 642 model_->Set(index, item); | 635 model_->Set(index, item); |
| 643 // It's possible we're waiting on more than one item, so don't break. | 636 // It's possible we're waiting on more than one item, so don't break. |
| 644 } | 637 } |
| 645 } | 638 } |
| 646 | 639 |
| 647 void ChromeLauncherControllerPerBrowser::OnAutoHideBehaviorChanged( | 640 void ChromeLauncherControllerPerBrowser::OnAutoHideBehaviorChanged( |
| 648 ash::ShelfAutoHideBehavior new_behavior) { | 641 ash::ShelfAutoHideBehavior new_behavior) { |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 DCHECK(browser); | 1329 DCHECK(browser); |
| 1337 if (browser->window()->IsActive()) | 1330 if (browser->window()->IsActive()) |
| 1338 status = ash::STATUS_ACTIVE; | 1331 status = ash::STATUS_ACTIVE; |
| 1339 else | 1332 else |
| 1340 status = ash::STATUS_RUNNING; | 1333 status = ash::STATUS_RUNNING; |
| 1341 } | 1334 } |
| 1342 item.status = status; | 1335 item.status = status; |
| 1343 | 1336 |
| 1344 model_->AddAt(index, item); | 1337 model_->AddAt(index, item); |
| 1345 | 1338 |
| 1346 if (controller->type() != LauncherItemController::TYPE_EXTENSION_PANEL) | 1339 app_icon_loader_->FetchImage(app_id); |
| 1347 app_icon_loader_->FetchImage(app_id); | |
| 1348 | 1340 |
| 1349 return id; | 1341 return id; |
| 1350 } | 1342 } |
| 1351 | 1343 |
| 1352 bool ChromeLauncherControllerPerBrowser::HasItemController( | 1344 bool ChromeLauncherControllerPerBrowser::HasItemController( |
| 1353 ash::LauncherID id) const { | 1345 ash::LauncherID id) const { |
| 1354 return id_to_item_controller_map_.find(id) != | 1346 return id_to_item_controller_map_.find(id) != |
| 1355 id_to_item_controller_map_.end(); | 1347 id_to_item_controller_map_.end(); |
| 1356 } | 1348 } |
| 1357 | 1349 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1374 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( | 1366 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( |
| 1375 extensions::AppIconLoader* loader) { | 1367 extensions::AppIconLoader* loader) { |
| 1376 app_icon_loader_.reset(loader); | 1368 app_icon_loader_.reset(loader); |
| 1377 } | 1369 } |
| 1378 | 1370 |
| 1379 const std::string& | 1371 const std::string& |
| 1380 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1372 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
| 1381 ash::LauncherID id) { | 1373 ash::LauncherID id) { |
| 1382 return id_to_item_controller_map_[id]->app_id(); | 1374 return id_to_item_controller_map_[id]->app_id(); |
| 1383 } | 1375 } |
| OLD | NEW |