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

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

Issue 9949012: Show CWS and FileManager icons in pinned apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_delegate.h" 5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h"
6 6
7 #include "ash/launcher/launcher_model.h" 7 #include "ash/launcher/launcher_model.h"
8 #include "ash/launcher/launcher_types.h" 8 #include "ash/launcher/launcher_types.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/defaults.h" 14 #include "chrome/browser/defaults.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/prefs/incognito_mode_prefs.h" 16 #include "chrome/browser/prefs/incognito_mode_prefs.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/tabs/tab_strip_model.h" 21 #include "chrome/browser/tabs/tab_strip_model.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
26 #include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h" 26 #include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h"
27 #include "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h" 27 #include "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h"
28 #include "chrome/browser/ui/views/ash/launcher/launcher_updater.h" 28 #include "chrome/browser/ui/views/ash/launcher/launcher_updater.h"
29 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
29 #include "chrome/browser/web_applications/web_app.h" 30 #include "chrome/browser/web_applications/web_app.h"
30 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/extensions/extension.h" 32 #include "chrome/common/extensions/extension.h"
33 #include "chrome/common/extensions/extension_constants.h"
32 #include "chrome/common/extensions/extension_resource.h" 34 #include "chrome/common/extensions/extension_resource.h"
33 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
34 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
35 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "grit/component_extension_resources.h"
36 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
37 #include "ui/aura/client/activation_client.h" 40 #include "ui/aura/client/activation_client.h"
38 #include "ui/aura/window.h" 41 #include "ui/aura/window.h"
39 #include "ui/views/widget/widget.h" 42 #include "ui/views/widget/widget.h"
40 43
41 namespace { 44 namespace {
42 45
43 // See description in PersistPinnedState(). 46 // See description in PersistPinnedState().
44 const char kAppIDPath[] = "id"; 47 const char kAppIDPath[] = "id";
45 const char kAppTypePanel[] = "panel"; 48 const char kAppTypePanel[] = "panel";
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 i != id_to_item_map_.end(); ++i) { 354 i != id_to_item_map_.end(); ++i) {
352 if (i->second.app_id != id) 355 if (i->second.app_id != id)
353 continue; 356 continue;
354 // Panel items may share the same app_id as the app that created them, 357 // Panel items may share the same app_id as the app that created them,
355 // but they set their icon image in LauncherUpdater::UpdateLauncher(), 358 // but they set their icon image in LauncherUpdater::UpdateLauncher(),
356 // so do not set panel images here. 359 // so do not set panel images here.
357 if (i->second.app_type == APP_TYPE_EXTENSION_PANEL) 360 if (i->second.app_type == APP_TYPE_EXTENSION_PANEL)
358 continue; 361 continue;
359 int index = model_->ItemIndexByID(i->first); 362 int index = model_->ItemIndexByID(i->first);
360 ash::LauncherItem item = model_->items()[index]; 363 ash::LauncherItem item = model_->items()[index];
364 // TODO(dpolukhin): remove this ugly hack and start using
365 // ExtensionIconSource that knows how to work with component extensions.
sky 2012/04/05 16:30:50 Why doesn't ImageLoadingTracker work for this? If
Dmitry Polukhin 2012/04/05 17:11:08 Good suggestion! I'll move similar code from Exten
366 if (id == extension_misc::kWebStoreAppId) {
367 item.image =
368 *ExtensionIconSource::LoadImageByResourceId(IDR_WEBSTORE_ICON_32);
369 } else if (id == "hhaomjibdihmijegdhdafkllkbggdgoj") {
370 item.image =
371 *ExtensionIconSource::LoadImageByResourceId(IDR_FILE_MANAGER_ICON_128);
372 } else if (image) {
361 item.image = image ? *image : Extension::GetDefaultIcon(true); 373 item.image = image ? *image : Extension::GetDefaultIcon(true);
374 }
362 model_->Set(index, item); 375 model_->Set(index, item);
363 // It's possible we're waiting on more than one item, so don't break. 376 // It's possible we're waiting on more than one item, so don't break.
364 } 377 }
365 } 378 }
366 379
367 bool ChromeLauncherDelegate::IsAppPinned(const std::string& app_id) { 380 bool ChromeLauncherDelegate::IsAppPinned(const std::string& app_id) {
368 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); 381 for (IDToItemMap::const_iterator i = id_to_item_map_.begin();
369 i != id_to_item_map_.end(); ++i) { 382 i != id_to_item_map_.end(); ++i) {
370 if (IsPinned(i->first) && i->second.app_id == app_id) 383 if (IsPinned(i->first) && i->second.app_id == app_id)
371 return true; 384 return true;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 while (!pending_pinned_apps_.empty()) { 597 while (!pending_pinned_apps_.empty()) {
585 const Item& item = pending_pinned_apps_.front(); 598 const Item& item = pending_pinned_apps_.front();
586 599
587 if (!app_icon_loader_->IsValidID(item.app_id)) 600 if (!app_icon_loader_->IsValidID(item.app_id))
588 return; 601 return;
589 602
590 PinAppWithID(item.app_id, item.app_type); 603 PinAppWithID(item.app_id, item.app_type);
591 pending_pinned_apps_.pop(); 604 pending_pinned_apps_.pop();
592 } 605 }
593 } 606 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698