| 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/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 const std::string& id, | 615 const std::string& id, |
| 616 const gfx::ImageSkia& image) { | 616 const gfx::ImageSkia& image) { |
| 617 // TODO: need to get this working for shortcuts. | 617 // TODO: need to get this working for shortcuts. |
| 618 | 618 |
| 619 for (IDToItemControllerMap::const_iterator i = | 619 for (IDToItemControllerMap::const_iterator i = |
| 620 id_to_item_controller_map_.begin(); | 620 id_to_item_controller_map_.begin(); |
| 621 i != id_to_item_controller_map_.end(); ++i) { | 621 i != id_to_item_controller_map_.end(); ++i) { |
| 622 if (i->second->app_id() != id) | 622 if (i->second->app_id() != id) |
| 623 continue; | 623 continue; |
| 624 | 624 |
| 625 // Panel items may share the same app_id as the app that created them, | |
| 626 // but they set their icon image in | |
| 627 // BrowserLauncherItemController::UpdateLauncher(), so do not set panel | |
| 628 // images here. | |
| 629 if (i->second->type() == LauncherItemController::TYPE_EXTENSION_PANEL) | |
| 630 continue; | |
| 631 | |
| 632 int index = model_->ItemIndexByID(i->first); | 625 int index = model_->ItemIndexByID(i->first); |
| 633 ash::LauncherItem item = model_->items()[index]; | 626 ash::LauncherItem item = model_->items()[index]; |
| 634 item.image = image; | 627 item.image = image; |
| 635 model_->Set(index, item); | 628 model_->Set(index, item); |
| 636 // It's possible we're waiting on more than one item, so don't break. | 629 // It's possible we're waiting on more than one item, so don't break. |
| 637 } | 630 } |
| 638 } | 631 } |
| 639 | 632 |
| 640 void ChromeLauncherControllerPerBrowser::SetLauncherItemImage( | 633 void ChromeLauncherControllerPerBrowser::SetLauncherItemImage( |
| 641 ash::LauncherID launcher_id, | 634 ash::LauncherID launcher_id, |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 DCHECK(browser); | 1293 DCHECK(browser); |
| 1301 if (browser->window()->IsActive()) | 1294 if (browser->window()->IsActive()) |
| 1302 status = ash::STATUS_ACTIVE; | 1295 status = ash::STATUS_ACTIVE; |
| 1303 else | 1296 else |
| 1304 status = ash::STATUS_RUNNING; | 1297 status = ash::STATUS_RUNNING; |
| 1305 } | 1298 } |
| 1306 item.status = status; | 1299 item.status = status; |
| 1307 | 1300 |
| 1308 model_->AddAt(index, item); | 1301 model_->AddAt(index, item); |
| 1309 | 1302 |
| 1310 if (controller->type() != LauncherItemController::TYPE_EXTENSION_PANEL) | 1303 app_icon_loader_->FetchImage(app_id); |
| 1311 app_icon_loader_->FetchImage(app_id); | |
| 1312 | 1304 |
| 1313 return id; | 1305 return id; |
| 1314 } | 1306 } |
| 1315 | 1307 |
| 1316 bool ChromeLauncherControllerPerBrowser::HasItemController( | 1308 bool ChromeLauncherControllerPerBrowser::HasItemController( |
| 1317 ash::LauncherID id) const { | 1309 ash::LauncherID id) const { |
| 1318 return id_to_item_controller_map_.find(id) != | 1310 return id_to_item_controller_map_.find(id) != |
| 1319 id_to_item_controller_map_.end(); | 1311 id_to_item_controller_map_.end(); |
| 1320 } | 1312 } |
| 1321 | 1313 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1338 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( | 1330 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( |
| 1339 extensions::AppIconLoader* loader) { | 1331 extensions::AppIconLoader* loader) { |
| 1340 app_icon_loader_.reset(loader); | 1332 app_icon_loader_.reset(loader); |
| 1341 } | 1333 } |
| 1342 | 1334 |
| 1343 const std::string& | 1335 const std::string& |
| 1344 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1336 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
| 1345 ash::LauncherID id) { | 1337 ash::LauncherID id) { |
| 1346 return id_to_item_controller_map_[id]->app_id(); | 1338 return id_to_item_controller_map_[id]->app_id(); |
| 1347 } | 1339 } |
| OLD | NEW |