| 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 6028f1a45a5289b510bca59af70fd4edf318644e..6763a04f547b5c0c4357893cbd4bee84cf60bb9c 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"
|
| @@ -50,6 +51,7 @@
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| #include "grit/google_chrome_strings.h"
|
| +#include "ui/app_list/app_list_model.h"
|
| #include "ui/app_list/pagination_model.h"
|
| #include "ui/app_list/views/app_list_view.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| @@ -268,6 +270,8 @@ class AppListControllerDelegateWin : public AppListControllerDelegate {
|
| virtual void LaunchApp(Profile* profile,
|
| const extensions::Extension* extension,
|
| int event_flags) OVERRIDE;
|
| + virtual void ShowForProfileByPath(
|
| + const base::FilePath& profile_path) OVERRIDE;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateWin);
|
| };
|
| @@ -425,6 +429,12 @@ bool AppListControllerDelegateWin::CanPin() {
|
| return false;
|
| }
|
|
|
| +void AppListControllerDelegateWin::ShowForProfileByPath(
|
| + const base::FilePath& profile_path) {
|
| + AppListController::GetInstance()->SetProfilePath(profile_path);
|
| + AppListController::GetInstance()->Show();
|
| +}
|
| +
|
| void AppListControllerDelegateWin::OnShowExtensionPrompt() {
|
| AppListController::GetInstance()->set_can_close(false);
|
| }
|
| @@ -531,13 +541,26 @@ void AppListController::ShowForProfile(Profile* requested_profile) {
|
|
|
| SetProfilePath(requested_profile->GetPath());
|
|
|
| - DismissAppList();
|
| - PopulateViewFromProfile(requested_profile);
|
| + // If the current view exists, switch the delegate's profile and rebuild the
|
| + // model.
|
| + if (current_view_) {
|
| + if (requested_profile != profile()) {
|
| + SetProfile(requested_profile);
|
| + view_delegate_->SetProfileByPath(requested_profile->GetPath());
|
| + }
|
| + } else {
|
| + PopulateViewFromProfile(requested_profile);
|
| + }
|
| +
|
| + // If the app list isn't visible, move the app list to the cursor position
|
| + // before showing it.
|
| + if (!IsAppListVisible()) {
|
| + gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
| + UpdateArrowPositionAndAnchorPoint(cursor);
|
| + }
|
|
|
| DCHECK(current_view_);
|
| EnsureHaveKeepAliveForView();
|
| - gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
| - UpdateArrowPositionAndAnchorPoint(cursor);
|
| current_view_->GetWidget()->Show();
|
| current_view_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon();
|
| current_view_->GetWidget()->Activate();
|
| @@ -560,9 +583,11 @@ 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());
|
| current_view_ = new app_list::AppListView(view_delegate_);
|
| +
|
| gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
| current_view_->InitAsBubble(NULL,
|
| &pagination_model_,
|
|
|