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

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

Issue 2090133003: Moved methods that don't rely on internal state out of ChromeLauncherController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed redundant #include statements Created 4 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/extensions/extension_util.h" 34 #include "chrome/browser/extensions/extension_util.h"
35 #include "chrome/browser/extensions/launch_util.h" 35 #include "chrome/browser/extensions/launch_util.h"
36 #include "chrome/browser/prefs/incognito_mode_prefs.h" 36 #include "chrome/browser/prefs/incognito_mode_prefs.h"
37 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/profiles/profile_manager.h" 38 #include "chrome/browser/profiles/profile_manager.h"
39 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 39 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
40 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" 40 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
41 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 41 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
42 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 42 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
43 #include "chrome/browser/ui/ash/app_sync_ui_state.h" 43 #include "chrome/browser/ui/ash/app_sync_ui_state.h"
44
tapted 2016/06/23 23:47:30 remove blank line
StarAZ 2016/06/24 14:15:17 Done.
44 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 45 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
45 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" 46 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
46 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h " 47 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h "
47 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 48 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
48 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" 49 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h"
49 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 50 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
50 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 51 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
51 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h" 52 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h"
52 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 53 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
53 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" 54 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
54 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h " 55 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h "
55 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" 56 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h"
57 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
56 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 58 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
57 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" 59 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h"
58 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" 60 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
59 #include "chrome/browser/ui/ash/launcher/launcher_extension_app_updater.h" 61 #include "chrome/browser/ui/ash/launcher/launcher_extension_app_updater.h"
60 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 62 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
61 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr oller.h" 63 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr oller.h"
62 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" 64 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h"
63 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 65 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
64 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
65 #include "chrome/browser/ui/browser.h" 67 #include "chrome/browser/ui/browser.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (!controller) 481 if (!controller)
480 return false; 482 return false;
481 return controller->IsOpen(); 483 return controller->IsOpen();
482 } 484 }
483 485
484 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) { 486 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) {
485 if (!HasShelfIDToAppIDMapping(id)) 487 if (!HasShelfIDToAppIDMapping(id))
486 return false; 488 return false;
487 489
488 std::string app_id = GetAppIDForShelfID(id); 490 std::string app_id = GetAppIDForShelfID(id);
489 const Extension* extension = GetExtensionForAppID(app_id); 491 const Extension* extension = GetExtensionForAppID(app_id, profile_);
490 // An extension can be synced / updated at any time and therefore not be 492 // An extension can be synced / updated at any time and therefore not be
491 // available. 493 // available.
492 return extension ? extension->is_platform_app() : false; 494 return extension ? extension->is_platform_app() : false;
493 } 495 }
494 496
495 void ChromeLauncherControllerImpl::LaunchApp(const std::string& app_id, 497 void ChromeLauncherControllerImpl::LaunchApp(const std::string& app_id,
496 ash::LaunchSource source, 498 ash::LaunchSource source,
497 int event_flags) { 499 int event_flags) {
498 launcher_controller_helper_->LaunchApp(app_id, source, event_flags); 500 launcher_controller_helper_->LaunchApp(app_id, source, event_flags);
499 } 501 }
(...skipping 14 matching lines...) Expand all
514 std::unique_ptr<AppShortcutLauncherItemController> app_controller( 516 std::unique_ptr<AppShortcutLauncherItemController> app_controller(
515 AppShortcutLauncherItemController::Create(app_id, this)); 517 AppShortcutLauncherItemController::Create(app_id, this));
516 if (!app_controller->GetRunningApplications().empty()) 518 if (!app_controller->GetRunningApplications().empty())
517 app_controller->Activate(source); 519 app_controller->Activate(source);
518 else 520 else
519 LaunchApp(app_id, source, event_flags); 521 LaunchApp(app_id, source, event_flags);
520 } 522 }
521 523
522 extensions::LaunchType ChromeLauncherControllerImpl::GetLaunchType( 524 extensions::LaunchType ChromeLauncherControllerImpl::GetLaunchType(
523 ash::ShelfID id) { 525 ash::ShelfID id) {
524 const Extension* extension = GetExtensionForAppID(GetAppIDForShelfID(id)); 526 const Extension* extension =
527 GetExtensionForAppID(GetAppIDForShelfID(id), profile_);
525 528
526 // An extension can be unloaded/updated/unavailable at any time. 529 // An extension can be unloaded/updated/unavailable at any time.
527 if (!extension) 530 if (!extension)
528 return extensions::LAUNCH_TYPE_DEFAULT; 531 return extensions::LAUNCH_TYPE_DEFAULT;
529 532
530 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_), 533 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_),
531 extension); 534 extension);
532 } 535 }
533 536
534 void ChromeLauncherControllerImpl::SetLauncherItemImage( 537 void ChromeLauncherControllerImpl::SetLauncherItemImage(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ash::ShelfItemType type = model_->items()[index].type; 642 ash::ShelfItemType type = model_->items()[index].type;
640 if (type == ash::TYPE_APP_SHORTCUT || type == ash::TYPE_WINDOWED_APP) { 643 if (type == ash::TYPE_APP_SHORTCUT || type == ash::TYPE_WINDOWED_APP) {
641 AppShortcutLauncherItemController* app_controller = 644 AppShortcutLauncherItemController* app_controller =
642 static_cast<AppShortcutLauncherItemController*>(controller); 645 static_cast<AppShortcutLauncherItemController*>(controller);
643 app_controller->set_refocus_url(url); 646 app_controller->set_refocus_url(url);
644 } else { 647 } else {
645 NOTREACHED() << "Invalid launcher type"; 648 NOTREACHED() << "Invalid launcher type";
646 } 649 }
647 } 650 }
648 651
649 const Extension* ChromeLauncherControllerImpl::GetExtensionForAppID(
650 const std::string& app_id) const {
651 return extensions::ExtensionRegistry::Get(profile_)->GetExtensionById(
652 app_id, extensions::ExtensionRegistry::EVERYTHING);
653 }
654
655 ash::ShelfItemDelegate::PerformedAction 652 ash::ShelfItemDelegate::PerformedAction
656 ChromeLauncherControllerImpl::ActivateWindowOrMinimizeIfActive( 653 ChromeLauncherControllerImpl::ActivateWindowOrMinimizeIfActive(
657 ui::BaseWindow* window, 654 ui::BaseWindow* window,
658 bool allow_minimize) { 655 bool allow_minimize) {
659 // In separated desktop mode we might have to teleport a window back to the 656 // In separated desktop mode we might have to teleport a window back to the
660 // current user. 657 // current user.
661 if (chrome::MultiUserWindowManager::GetMultiProfileMode() == 658 if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
662 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) { 659 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) {
663 aura::Window* native_window = window->GetNativeWindow(); 660 aura::Window* native_window = window->GetNativeWindow();
664 const AccountId& current_account_id = 661 const AccountId& current_account_id =
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 bool ChromeLauncherControllerImpl::ContentCanBeHandledByGmailApp( 771 bool ChromeLauncherControllerImpl::ContentCanBeHandledByGmailApp(
775 content::WebContents* web_contents) { 772 content::WebContents* web_contents) {
776 ash::ShelfID id = GetShelfIDForAppID(kGmailAppId); 773 ash::ShelfID id = GetShelfIDForAppID(kGmailAppId);
777 if (id) { 774 if (id) {
778 const GURL url = web_contents->GetURL(); 775 const GURL url = web_contents->GetURL();
779 // We need to extend the application matching for the gMail app beyond the 776 // We need to extend the application matching for the gMail app beyond the
780 // manifest file's specification. This is required because of the namespace 777 // manifest file's specification. This is required because of the namespace
781 // overlap with the offline app ("/mail/mu/"). 778 // overlap with the offline app ("/mail/mu/").
782 if (!base::MatchPattern(url.path(), "/mail/mu/*") && 779 if (!base::MatchPattern(url.path(), "/mail/mu/*") &&
783 base::MatchPattern(url.path(), "/mail/*") && 780 base::MatchPattern(url.path(), "/mail/*") &&
784 GetExtensionForAppID(kGmailAppId) && 781 GetExtensionForAppID(kGmailAppId, profile_) &&
785 GetExtensionForAppID(kGmailAppId)->OverlapsWithOrigin(url)) 782 GetExtensionForAppID(kGmailAppId, profile_)->OverlapsWithOrigin(url))
786 return true; 783 return true;
787 } 784 }
788 return false; 785 return false;
789 } 786 }
790 787
791 gfx::Image ChromeLauncherControllerImpl::GetAppListIcon( 788 gfx::Image ChromeLauncherControllerImpl::GetAppListIcon(
792 content::WebContents* web_contents) const { 789 content::WebContents* web_contents) const {
793 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 790 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
794 if (IsIncognito(web_contents)) 791 if (IsIncognito(web_contents))
795 return rb.GetImageNamed(IDR_ASH_SHELF_LIST_INCOGNITO_BROWSER); 792 return rb.GetImageNamed(IDR_ASH_SHELF_LIST_INCOGNITO_BROWSER);
796 favicon::FaviconDriver* favicon_driver = 793 favicon::FaviconDriver* favicon_driver =
797 favicon::ContentFaviconDriver::FromWebContents(web_contents); 794 favicon::ContentFaviconDriver::FromWebContents(web_contents);
798 gfx::Image result = favicon_driver->GetFavicon(); 795 gfx::Image result = favicon_driver->GetFavicon();
799 if (result.IsEmpty()) 796 if (result.IsEmpty())
800 return rb.GetImageNamed(IDR_DEFAULT_FAVICON); 797 return rb.GetImageNamed(IDR_DEFAULT_FAVICON);
801 return result; 798 return result;
802 } 799 }
803 800
804 base::string16 ChromeLauncherControllerImpl::GetAppListTitle( 801 base::string16 ChromeLauncherControllerImpl::GetAppListTitle(
805 content::WebContents* web_contents) const { 802 content::WebContents* web_contents) const {
806 base::string16 title = web_contents->GetTitle(); 803 base::string16 title = web_contents->GetTitle();
807 if (!title.empty()) 804 if (!title.empty())
808 return title; 805 return title;
809 WebContentsToAppIDMap::const_iterator iter = 806 WebContentsToAppIDMap::const_iterator iter =
810 web_contents_to_app_id_.find(web_contents); 807 web_contents_to_app_id_.find(web_contents);
811 if (iter != web_contents_to_app_id_.end()) { 808 if (iter != web_contents_to_app_id_.end()) {
812 std::string app_id = iter->second; 809 std::string app_id = iter->second;
813 const extensions::Extension* extension = GetExtensionForAppID(app_id); 810 const extensions::Extension* extension =
811 GetExtensionForAppID(app_id, profile_);
814 if (extension) 812 if (extension)
815 return base::UTF8ToUTF16(extension->name()); 813 return base::UTF8ToUTF16(extension->name());
816 } 814 }
817 return l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); 815 return l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
818 } 816 }
819 817
820 BrowserShortcutLauncherItemController* 818 BrowserShortcutLauncherItemController*
821 ChromeLauncherControllerImpl::GetBrowserShortcutLauncherItemController() { 819 ChromeLauncherControllerImpl::GetBrowserShortcutLauncherItemController() {
822 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin(); 820 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin();
823 i != id_to_item_controller_map_.end(); ++i) { 821 i != id_to_item_controller_map_.end(); ++i) {
(...skipping 21 matching lines...) Expand all
845 } 843 }
846 } 844 }
847 845
848 LauncherItemController* ChromeLauncherControllerImpl::GetLauncherItemController( 846 LauncherItemController* ChromeLauncherControllerImpl::GetLauncherItemController(
849 const ash::ShelfID id) { 847 const ash::ShelfID id) {
850 if (!HasShelfIDToAppIDMapping(id)) 848 if (!HasShelfIDToAppIDMapping(id))
851 return NULL; 849 return NULL;
852 return id_to_item_controller_map_[id]; 850 return id_to_item_controller_map_[id];
853 } 851 }
854 852
855 bool ChromeLauncherControllerImpl::IsBrowserFromActiveUser(Browser* browser) {
856 // If running multi user mode with separate desktops, we have to check if the
857 // browser is from the active user.
858 if (chrome::MultiUserWindowManager::GetMultiProfileMode() !=
859 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED)
860 return true;
861 return multi_user_util::IsProfileFromActiveUser(browser->profile());
862 }
863
864 bool ChromeLauncherControllerImpl::ShelfBoundsChangesProbablyWithUser( 853 bool ChromeLauncherControllerImpl::ShelfBoundsChangesProbablyWithUser(
865 ash::Shelf* shelf, 854 ash::Shelf* shelf,
866 const std::string& user_id) const { 855 const std::string& user_id) const {
867 Profile* other_profile = multi_user_util::GetProfileFromAccountId( 856 Profile* other_profile = multi_user_util::GetProfileFromAccountId(
868 AccountId::FromUserEmail(user_id)); 857 AccountId::FromUserEmail(user_id));
869 if (other_profile == profile_) 858 if (other_profile == profile_)
870 return false; 859 return false;
871 860
872 // Note: The Auto hide state from preferences is not the same as the actual 861 // Note: The Auto hide state from preferences is not the same as the actual
873 // visibility of the shelf. Depending on all the various states (full screen, 862 // visibility of the shelf. Depending on all the various states (full screen,
(...skipping 12 matching lines...) Expand all
886 ash::launcher::GetShelfAlignmentPref(prefs, display) != 875 ash::launcher::GetShelfAlignmentPref(prefs, display) !=
887 ash::launcher::GetShelfAlignmentPref(other_prefs, display); 876 ash::launcher::GetShelfAlignmentPref(other_prefs, display);
888 } 877 }
889 878
890 void ChromeLauncherControllerImpl::OnUserProfileReadyToSwitch( 879 void ChromeLauncherControllerImpl::OnUserProfileReadyToSwitch(
891 Profile* profile) { 880 Profile* profile) {
892 if (user_switch_observer_.get()) 881 if (user_switch_observer_.get())
893 user_switch_observer_->OnUserProfileReadyToSwitch(profile); 882 user_switch_observer_->OnUserProfileReadyToSwitch(profile);
894 } 883 }
895 884
896 AppListControllerDelegate::Pinnable ChromeLauncherControllerImpl::GetPinnable(
897 const std::string& app_id) {
898 const base::ListValue* pref =
899 profile_->GetPrefs()->GetList(prefs::kPolicyPinnedLauncherApps);
900 if (!pref)
901 return AppListControllerDelegate::PIN_EDITABLE;
902
903 // Pinned ARC apps policy defines the package name of the apps, that must
904 // be pinned. All the launch activities of any package in policy are pinned.
905 // In turn the input parameter to this function is app_id, which
906 // is 32 chars hash. In case of ARC app this is a hash of
907 // (package name + activity). This means that we must identify the package
908 // from the hash, and check if this package is pinned by policy.
909 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(GetProfile());
910 std::string arc_app_packege_name;
911 if (arc_prefs) {
912 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
913 arc_prefs->GetApp(app_id);
914 if (app_info)
915 arc_app_packege_name = app_info->package_name;
916 }
917
918 for (size_t index = 0; index < pref->GetSize(); ++index) {
919 const base::DictionaryValue* app = nullptr;
920 std::string app_id_or_package;
921 if (pref->GetDictionary(index, &app) &&
922 app->GetString(ash::launcher::kPinnedAppsPrefAppIDPath,
923 &app_id_or_package) &&
924 (app_id == app_id_or_package ||
925 arc_app_packege_name == app_id_or_package)) {
926 return AppListControllerDelegate::PIN_FIXED;
927 }
928 }
929 return AppListControllerDelegate::PIN_EDITABLE;
930 }
931
932 ArcAppDeferredLauncherController* 885 ArcAppDeferredLauncherController*
933 ChromeLauncherControllerImpl::GetArcDeferredLauncher() { 886 ChromeLauncherControllerImpl::GetArcDeferredLauncher() {
934 return arc_deferred_launcher_.get(); 887 return arc_deferred_launcher_.get();
935 } 888 }
936 889
937 /////////////////////////////////////////////////////////////////////////////// 890 ///////////////////////////////////////////////////////////////////////////////
938 // ash::ShelfDelegate: 891 // ash::ShelfDelegate:
939 892
940 void ChromeLauncherControllerImpl::OnShelfCreated(ash::Shelf* shelf) { 893 void ChromeLauncherControllerImpl::OnShelfCreated(ash::Shelf* shelf) {
941 PrefService* prefs = profile_->GetPrefs(); 894 PrefService* prefs = profile_->GetPrefs();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 id_to_item_controller_map_.end(); 940 id_to_item_controller_map_.end();
988 } 941 }
989 942
990 const std::string& ChromeLauncherControllerImpl::GetAppIDForShelfID( 943 const std::string& ChromeLauncherControllerImpl::GetAppIDForShelfID(
991 ash::ShelfID id) { 944 ash::ShelfID id) {
992 LauncherItemController* controller = GetLauncherItemController(id); 945 LauncherItemController* controller = GetLauncherItemController(id);
993 return controller ? controller->app_id() : base::EmptyString(); 946 return controller ? controller->app_id() : base::EmptyString();
994 } 947 }
995 948
996 void ChromeLauncherControllerImpl::PinAppWithID(const std::string& app_id) { 949 void ChromeLauncherControllerImpl::PinAppWithID(const std::string& app_id) {
997 if (GetPinnable(app_id) == AppListControllerDelegate::PIN_EDITABLE) 950 if (GetPinnableForAppID(app_id, profile_) ==
951 AppListControllerDelegate::PIN_EDITABLE)
998 DoPinAppWithID(app_id); 952 DoPinAppWithID(app_id);
999 else 953 else
1000 NOTREACHED(); 954 NOTREACHED();
1001 } 955 }
1002 956
1003 bool ChromeLauncherControllerImpl::IsAppPinned(const std::string& app_id) { 957 bool ChromeLauncherControllerImpl::IsAppPinned(const std::string& app_id) {
1004 for (IDToItemControllerMap::const_iterator i = 958 for (IDToItemControllerMap::const_iterator i =
1005 id_to_item_controller_map_.begin(); 959 id_to_item_controller_map_.begin();
1006 i != id_to_item_controller_map_.end(); ++i) { 960 i != id_to_item_controller_map_.end(); ++i) {
1007 if (IsPinned(i->first) && i->second->app_id() == app_id) 961 if (IsPinned(i->first) && i->second->app_id() == app_id)
1008 return true; 962 return true;
1009 } 963 }
1010 return false; 964 return false;
1011 } 965 }
1012 966
1013 void ChromeLauncherControllerImpl::UnpinAppWithID(const std::string& app_id) { 967 void ChromeLauncherControllerImpl::UnpinAppWithID(const std::string& app_id) {
1014 if (GetPinnable(app_id) == AppListControllerDelegate::PIN_EDITABLE) 968 if (GetPinnableForAppID(app_id, profile_) ==
969 AppListControllerDelegate::PIN_EDITABLE)
1015 DoUnpinAppWithID(app_id); 970 DoUnpinAppWithID(app_id);
1016 else 971 else
1017 NOTREACHED(); 972 NOTREACHED();
1018 } 973 }
1019 974
1020 /////////////////////////////////////////////////////////////////////////////// 975 ///////////////////////////////////////////////////////////////////////////////
1021 // LauncherAppUpdater::Delegate: 976 // LauncherAppUpdater::Delegate:
1022 977
1023 void ChromeLauncherControllerImpl::OnAppInstalled( 978 void ChromeLauncherControllerImpl::OnAppInstalled(
1024 content::BrowserContext* browser_context, 979 content::BrowserContext* browser_context,
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 if (index == -1) 1707 if (index == -1)
1753 continue; 1708 continue;
1754 ash::ShelfItem item = model_->items()[index]; 1709 ash::ShelfItem item = model_->items()[index];
1755 item.image = image; 1710 item.image = image;
1756 if (arc_deferred_launcher_) 1711 if (arc_deferred_launcher_)
1757 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); 1712 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image);
1758 model_->Set(index, item); 1713 model_->Set(index, item);
1759 // It's possible we're waiting on more than one item, so don't break. 1714 // It's possible we're waiting on more than one item, so don't break.
1760 } 1715 }
1761 } 1716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698