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

Unified Diff: chrome/browser/ui/app_list/app_list_service_mac.mm

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove binary changes Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
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 e3e4010e6ad1b529bdc816ea683a3fdf31bac1eb..298cc586213bcf13d1ce37fa9771162a356faacd 100644
--- a/chrome/browser/ui/app_list/app_list_service_mac.mm
+++ b/chrome/browser/ui/app_list/app_list_service_mac.mm
@@ -36,6 +36,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"
@@ -96,6 +97,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);
};
@@ -244,6 +247,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,
@@ -409,15 +419,18 @@ void AppListServiceMac::CreateForProfile(Profile* requested_profile) {
if (profile() == requested_profile)
return;
- // The Objective C objects might be released at some unknown point in the
- // future, so explicitly clear references to C++ objects.
- [[window_controller_ appListViewController]
- setDelegate:scoped_ptr<app_list::AppListViewDelegate>()];
-
SetProfile(requested_profile);
+
+ if (window_controller_) {
+ // Clear the search box.
+ [[window_controller_ appListViewController] searchBoxModel]
+ ->SetText(base::string16());
+ } else {
+ window_controller_.reset([[AppListWindowController alloc] init]);
+ }
+
scoped_ptr<app_list::AppListViewDelegate> delegate(
new AppListViewDelegate(new AppListControllerDelegateCocoa(), profile()));
- window_controller_.reset([[AppListWindowController alloc] init]);
[[window_controller_ appListViewController] setDelegate:delegate.Pass()];
}
@@ -427,14 +440,12 @@ void AppListServiceMac::ShowForProfile(Profile* requested_profile) {
InvalidatePendingProfileLoads();
- if (IsAppListVisible() && (requested_profile == profile())) {
+ if (requested_profile == profile()) {
ShowWindowNearDock();
return;
}
SetProfilePath(requested_profile->GetPath());
-
- DismissAppList();
CreateForProfile(requested_profile);
ShowWindowNearDock();
}
@@ -506,6 +517,9 @@ void AppListServiceMac::OnShimSetHidden(apps::AppShimHandler::Host* host,
void AppListServiceMac::OnShimQuit(apps::AppShimHandler::Host* host) {}
void AppListServiceMac::ShowWindowNearDock() {
+ if (IsAppListVisible())
+ return;
+
NSWindow* window = GetAppListWindow();
DCHECK(window);
NSPoint target_origin;
« no previous file with comments | « chrome/browser/ui/app_list/app_list_controller_delegate.h ('k') | chrome/browser/ui/app_list/app_list_view_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698