Chromium Code Reviews| Index: chrome/browser/ui/views/app_list/app_list_controller_win.cc |
| diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc |
| index 6bbb59584622aa70edee1cbf4d2cc11df805a221..a52411b664945eb1de2655d84788109bfc92ffa7 100644 |
| --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc |
| +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc |
| @@ -25,6 +25,7 @@ |
| #include "chrome/browser/extensions/extension_system.h" |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/platform_util.h" |
| +#include "chrome/browser/profiles/avatar_menu_model.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/shell_integration.h" |
| @@ -268,6 +269,7 @@ class AppListControllerDelegateWin : public AppListControllerDelegate { |
| virtual void LaunchApp(Profile* profile, |
| const extensions::Extension* extension, |
| int event_flags) OVERRIDE; |
| + virtual void ShowForProfileAtIndex(size_t index) OVERRIDE; |
| DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateWin); |
| }; |
| @@ -308,6 +310,7 @@ class AppListController : public AppListServiceImpl { |
| virtual void HandleFirstRun() OVERRIDE; |
| virtual void Init(Profile* initial_profile) OVERRIDE; |
| virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; |
| + virtual void ShowForProfileAtIndex(size_t index) OVERRIDE; |
| virtual void DismissAppList() OVERRIDE; |
| virtual bool IsAppListVisible() const OVERRIDE; |
| virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; |
| @@ -425,6 +428,10 @@ bool AppListControllerDelegateWin::CanPin() { |
| return false; |
| } |
| +void AppListControllerDelegateWin::ShowForProfileAtIndex(size_t index) { |
| + AppListController::GetInstance()->ShowForProfileAtIndex(index); |
| +} |
| + |
| void AppListControllerDelegateWin::OnShowExtensionPrompt() { |
| AppListController::GetInstance()->set_can_close(false); |
| } |
| @@ -561,8 +568,13 @@ void AppListController::PopulateViewFromProfile(Profile* requested_profile) { |
| // The controller will be owned by the view delegate, and the delegate is |
| // owned by the app list view. The app list view manages it's own lifetime. |
| - view_delegate_ = new AppListViewDelegate(CreateControllerDelegate(), |
| - profile()); |
| + view_delegate_ = new AppListViewDelegate( |
| + CreateControllerDelegate(), |
| + profile(), |
| + new AvatarMenuModel( |
| + &g_browser_process->profile_manager()->GetProfileInfoCache(), |
| + NULL, |
| + NULL)); |
| current_view_ = new app_list::AppListView(view_delegate_); |
| gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); |
| current_view_->InitAsBubble(NULL, |
| @@ -980,6 +992,20 @@ void AppListController::LoadProfileForWarmup() { |
| weak_factory_.GetWeakPtr())); |
| } |
| +void AppListController::ShowForProfileAtIndex(size_t index) { |
|
tapted
2013/07/29 01:59:10
Can this be moved to AppListServiceImpl?
calamity
2013/07/30 08:42:34
Done.
|
| + ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| + ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
| + if (index >= cache.GetNumberOfProfiles()) { |
| + NOTREACHED(); |
| + return; |
| + } |
| + base::FilePath profile_path = cache.GetPathOfProfileAtIndex(index); |
| + profile_loader().LoadProfileInvalidatingOtherLoads( |
| + profile_path, |
| + base::Bind(&AppListController::ShowForProfile, |
| + weak_factory_.GetWeakPtr())); |
| +} |
| + |
| } // namespace |
| namespace chrome { |