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

Unified Diff: chrome/browser/ui/views/app_list/app_list_controller_win.cc

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo app_list_service_mac changes Created 7 years, 5 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/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..223739b3495bffcd7063f85f14f8400ed2daed81 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,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);
};
@@ -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);
}
@@ -531,13 +538,27 @@ void AppListController::ShowForProfile(Profile* requested_profile) {
SetProfilePath(requested_profile->GetPath());
- DismissAppList();
- PopulateViewFromProfile(requested_profile);
+ // If the current view and delegate exist, switch the delegate's profile and
+ // rebuild the model.
+ if (current_view_ && view_delegate_) {
koz (OOO until 15th September) 2013/07/31 03:01:42 current_view_ being not NULL implies view_delegate
calamity 2013/08/01 08:35:45 Done.
+ if (requested_profile != profile()) {
+ SetProfile(requested_profile);
+ view_delegate_->SetProfile(requested_profile);
+ current_view_->SetModel(new app_list::AppListModel());
+ }
+ } 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,8 +581,9 @@ 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,

Powered by Google App Engine
This is Rietveld 408576698