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

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

Issue 105733003: Move LaunchType out of ExtensionPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indenting Created 7 years 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 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.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // Create a temporary application launcher item and use it to see if there are 694 // Create a temporary application launcher item and use it to see if there are
695 // running instances. 695 // running instances.
696 scoped_ptr<AppShortcutLauncherItemController> app_controller( 696 scoped_ptr<AppShortcutLauncherItemController> app_controller(
697 new AppShortcutLauncherItemController(app_id, this)); 697 new AppShortcutLauncherItemController(app_id, this));
698 if (!app_controller->GetRunningApplications().empty()) 698 if (!app_controller->GetRunningApplications().empty())
699 app_controller->Activate(source); 699 app_controller->Activate(source);
700 else 700 else
701 LaunchApp(app_id, source, event_flags); 701 LaunchApp(app_id, source, event_flags);
702 } 702 }
703 703
704 extensions::ExtensionPrefs::LaunchType 704 extensions::LaunchType ChromeLauncherController::GetLaunchType(
705 ChromeLauncherController::GetLaunchType(ash::LauncherID id) { 705 ash::LauncherID id) {
706 DCHECK(HasItemController(id)); 706 DCHECK(HasItemController(id));
707 707
708 const Extension* extension = GetExtensionForAppID( 708 const Extension* extension = GetExtensionForAppID(
709 id_to_item_controller_map_[id]->app_id()); 709 id_to_item_controller_map_[id]->app_id());
710 710
711 // An extension can be unloaded/updated/unavailable at any time. 711 // An extension can be unloaded/updated/unavailable at any time.
712 if (!extension) 712 if (!extension)
713 return extensions::ExtensionPrefs::LAUNCH_TYPE_DEFAULT; 713 return extensions::LAUNCH_TYPE_DEFAULT;
714 714
715 return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( 715 return extensions::GetLaunchType(
716 profile_->GetExtensionService()->extension_prefs(),
716 extension); 717 extension);
717 } 718 }
718 719
719 ash::LauncherID ChromeLauncherController::GetLauncherIDForAppID( 720 ash::LauncherID ChromeLauncherController::GetLauncherIDForAppID(
720 const std::string& app_id) { 721 const std::string& app_id) {
721 for (IDToItemControllerMap::const_iterator i = 722 for (IDToItemControllerMap::const_iterator i =
722 id_to_item_controller_map_.begin(); 723 id_to_item_controller_map_.begin();
723 i != id_to_item_controller_map_.end(); ++i) { 724 i != id_to_item_controller_map_.end(); ++i) {
724 if (i->second->type() == LauncherItemController::TYPE_APP_PANEL) 725 if (i->second->type() == LauncherItemController::TYPE_APP_PANEL)
725 continue; // Don't include panels 726 continue; // Don't include panels
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 802
802 void ChromeLauncherController::PinAppWithID(const std::string& app_id) { 803 void ChromeLauncherController::PinAppWithID(const std::string& app_id) {
803 if (CanPin()) 804 if (CanPin())
804 DoPinAppWithID(app_id); 805 DoPinAppWithID(app_id);
805 else 806 else
806 NOTREACHED(); 807 NOTREACHED();
807 } 808 }
808 809
809 void ChromeLauncherController::SetLaunchType( 810 void ChromeLauncherController::SetLaunchType(
810 ash::LauncherID id, 811 ash::LauncherID id,
811 extensions::ExtensionPrefs::LaunchType launch_type) { 812 extensions::LaunchType launch_type) {
812 if (!HasItemController(id)) 813 if (!HasItemController(id))
813 return; 814 return;
814 815
815 profile_->GetExtensionService()->extension_prefs()->SetLaunchType( 816 extensions::SetLaunchType(profile_->GetExtensionService()->extension_prefs(),
816 id_to_item_controller_map_[id]->app_id(), launch_type); 817 id_to_item_controller_map_[id]->app_id(),
818 launch_type);
817 } 819 }
818 820
819 void ChromeLauncherController::UnpinAppWithID(const std::string& app_id) { 821 void ChromeLauncherController::UnpinAppWithID(const std::string& app_id) {
820 if (CanPin()) 822 if (CanPin())
821 DoUnpinAppWithID(app_id); 823 DoUnpinAppWithID(app_id);
822 else 824 else
823 NOTREACHED(); 825 NOTREACHED();
824 } 826 }
825 827
826 bool ChromeLauncherController::IsLoggedInAsGuest() { 828 bool ChromeLauncherController::IsLoggedInAsGuest() {
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 } 2013 }
2012 2014
2013 void ChromeLauncherController::ReleaseProfile() { 2015 void ChromeLauncherController::ReleaseProfile() {
2014 if (app_sync_ui_state_) 2016 if (app_sync_ui_state_)
2015 app_sync_ui_state_->RemoveObserver(this); 2017 app_sync_ui_state_->RemoveObserver(this);
2016 2018
2017 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2019 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2018 2020
2019 pref_change_registrar_.RemoveAll(); 2021 pref_change_registrar_.RemoveAll();
2020 } 2022 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.h ('k') | chrome/browser/ui/ash/launcher/launcher_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698