| 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/views/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 const std::string& app_id) { | 338 const std::string& app_id) { |
| 339 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); | 339 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); |
| 340 i != id_to_item_map_.end(); ++i) { | 340 i != id_to_item_map_.end(); ++i) { |
| 341 if (i->second.app_id == app_id) | 341 if (i->second.app_id == app_id) |
| 342 return i->first; | 342 return i->first; |
| 343 } | 343 } |
| 344 return 0; | 344 return 0; |
| 345 } | 345 } |
| 346 | 346 |
| 347 void ChromeLauncherController::SetAppImage(const std::string& id, | 347 void ChromeLauncherController::SetAppImage(const std::string& id, |
| 348 const SkBitmap* image) { | 348 const gfx::ImageSkia& image) { |
| 349 // TODO: need to get this working for shortcuts. | 349 // TODO: need to get this working for shortcuts. |
| 350 | 350 |
| 351 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); | 351 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); |
| 352 i != id_to_item_map_.end(); ++i) { | 352 i != id_to_item_map_.end(); ++i) { |
| 353 if (i->second.app_id != id) | 353 if (i->second.app_id != id) |
| 354 continue; | 354 continue; |
| 355 | 355 |
| 356 // Panel items may share the same app_id as the app that created them, | 356 // Panel items may share the same app_id as the app that created them, |
| 357 // but they set their icon image in | 357 // but they set their icon image in |
| 358 // BrowserLauncherItemController::UpdateLauncher(), so do not set panel | 358 // BrowserLauncherItemController::UpdateLauncher(), so do not set panel |
| 359 // images here. | 359 // images here. |
| 360 if (i->second.controller && | 360 if (i->second.controller && |
| 361 i->second.controller->type() == | 361 i->second.controller->type() == |
| 362 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { | 362 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { |
| 363 continue; | 363 continue; |
| 364 } | 364 } |
| 365 | 365 |
| 366 int index = model_->ItemIndexByID(i->first); | 366 int index = model_->ItemIndexByID(i->first); |
| 367 ash::LauncherItem item = model_->items()[index]; | 367 ash::LauncherItem item = model_->items()[index]; |
| 368 item.image = image ? *image : Extension::GetDefaultIcon(true); | 368 item.image = image; |
| 369 model_->Set(index, item); | 369 model_->Set(index, item); |
| 370 // It's possible we're waiting on more than one item, so don't break. | 370 // It's possible we're waiting on more than one item, so don't break. |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool ChromeLauncherController::IsAppPinned(const std::string& app_id) { | 374 bool ChromeLauncherController::IsAppPinned(const std::string& app_id) { |
| 375 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); | 375 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); |
| 376 i != id_to_item_map_.end(); ++i) { | 376 i != id_to_item_map_.end(); ++i) { |
| 377 if (IsPinned(i->first) && i->second.app_id == app_id) | 377 if (IsPinned(i->first) && i->second.app_id == app_id) |
| 378 return true; | 378 return true; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 } | 933 } |
| 934 model_->AddAt(index, item); | 934 model_->AddAt(index, item); |
| 935 | 935 |
| 936 if (!controller || controller->type() != | 936 if (!controller || controller->type() != |
| 937 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { | 937 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { |
| 938 if (item.status != ash::STATUS_IS_PENDING) | 938 if (item.status != ash::STATUS_IS_PENDING) |
| 939 app_icon_loader_->FetchImage(app_id); | 939 app_icon_loader_->FetchImage(app_id); |
| 940 } | 940 } |
| 941 return id; | 941 return id; |
| 942 } | 942 } |
| OLD | NEW |