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

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: rework 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 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 {

Powered by Google App Engine
This is Rietveld 408576698