Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service_mac.mm |
| diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm |
| index 217f2ac706dc8b531a5adb038cecbf45b474aa0c..fcd21a666fed577b575bc10654eb8e3bb8c720b4 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service_mac.mm |
| +++ b/chrome/browser/ui/app_list/app_list_service_mac.mm |
| @@ -37,6 +37,7 @@ |
| #include "grit/google_chrome_strings.h" |
| #import "ui/app_list/cocoa/app_list_view_controller.h" |
| #import "ui/app_list/cocoa/app_list_window_controller.h" |
| +#include "ui/app_list/search_box_model.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/display.h" |
| @@ -97,6 +98,8 @@ class AppListControllerDelegateCocoa : 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(AppListControllerDelegateCocoa); |
| }; |
| @@ -268,6 +271,13 @@ void AppListControllerDelegateCocoa::LaunchApp( |
| profile, extension, NEW_FOREGROUND_TAB)); |
| } |
| +void AppListControllerDelegateCocoa::ShowForProfileByPath( |
| + const base::FilePath& profile_path) { |
| + AppListService* service = AppListServiceMac::GetInstance(); |
| + service->SetProfilePath(profile_path); |
| + service->Show(); |
| +} |
| + |
| enum DockLocation { |
| DockLocationOtherDisplay, |
| DockLocationBottom, |
| @@ -463,10 +473,22 @@ void AppListServiceMac::ShowForProfile(Profile* requested_profile) { |
| } |
| SetProfilePath(requested_profile->GetPath()); |
| - |
| - DismissAppList(); |
| - CreateForProfile(requested_profile); |
| - ShowWindowNearDock(); |
| + if (!window_controller_) { |
| + DismissAppList(); |
|
tapted
2013/09/13 23:12:17
this will always be a no-op with the condition abo
calamity
2013/09/16 19:45:26
Removed.
|
| + CreateForProfile(requested_profile); |
| + } else if (requested_profile != profile()) { |
| + // Clear the search box text when switching profiles. |
| + [[window_controller_ appListViewController] searchBoxModel] |
| + ->SetText(base::string16()); |
| + |
| + SetProfile(requested_profile); |
| + scoped_ptr<app_list::AppListViewDelegate> delegate( |
| + new AppListViewDelegate(new AppListControllerDelegateCocoa(), |
| + requested_profile)); |
| + [[window_controller_ appListViewController] setDelegate:delegate.Pass()]; |
| + } |
| + if (!IsAppListVisible()) |
|
tapted
2013/09/13 23:12:17
I think this check can just go at the start of Sho
calamity
2013/09/16 19:45:26
Done.
|
| + ShowWindowNearDock(); |
| } |
| void AppListServiceMac::DismissAppList() { |