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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc

Issue 10699065: chromeos: Fix pixelated icons in app list and launcher (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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 | Annotate | Revision Log
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/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
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) 877 for (; pref_app_id != pinned_apps.end(); ++pref_app_id)
878 CreateAppLauncherItem(NULL, *pref_app_id, ash::STATUS_CLOSED); 878 CreateAppLauncherItem(NULL, *pref_app_id, ash::STATUS_CLOSED);
879 } 879 }
880 880
881 TabContents* ChromeLauncherController::GetLastActiveTabContents( 881 TabContents* ChromeLauncherController::GetLastActiveTabContents(
882 const std::string& app_id) { 882 const std::string& app_id) {
883 AppIDToTabContentsListMap::const_iterator i = 883 AppIDToTabContentsListMap::const_iterator i =
884 app_id_to_tab_contents_list_.find(app_id); 884 app_id_to_tab_contents_list_.find(app_id);
885 if (i == app_id_to_tab_contents_list_.end()) 885 if (i == app_id_to_tab_contents_list_.end())
886 return NULL; 886 return NULL;
887 DCHECK(i->second.size() > 0); 887 DCHECK_GT(i->second.size(), 0u);
888 return *i->second.begin(); 888 return *i->second.begin();
889 } 889 }
890 890
891 ash::LauncherID ChromeLauncherController::InsertAppLauncherItem( 891 ash::LauncherID ChromeLauncherController::InsertAppLauncherItem(
892 BrowserLauncherItemController* controller, 892 BrowserLauncherItemController* controller,
893 const std::string& app_id, 893 const std::string& app_id,
894 ash::LauncherItemStatus status, 894 ash::LauncherItemStatus status,
895 int index) { 895 int index) {
896 ash::LauncherID id = model_->next_id(); 896 ash::LauncherID id = model_->next_id();
897 DCHECK(id_to_item_map_.find(id) == id_to_item_map_.end()); 897 DCHECK(id_to_item_map_.find(id) == id_to_item_map_.end());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698