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

Unified Diff: chrome/browser/ui/app_list/app_list_service_impl.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/app_list/app_list_service_impl.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc
index 8054e8753103c4099deae6845ff5516775996d2f..d4920ef2aef2804201936ac3148fbef1e5ee1b61 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -17,6 +17,7 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
namespace {
@@ -199,6 +200,8 @@ void AppListServiceImpl::SetProfile(Profile* new_profile) {
if (!profile_)
return;
+ registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
+ content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED,
@@ -211,6 +214,20 @@ void AppListServiceImpl::InvalidatePendingProfileLoads() {
profile_loader_.InvalidatePendingProfileLoads();
}
+void AppListServiceImpl::ShowForProfileAtIndex(size_t index) {
+ 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(&AppListServiceImpl::ShowForProfile,
+ weak_factory_.GetWeakPtr()));
+}
+
void AppListServiceImpl::HandleCommandLineFlags(Profile* initial_profile) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppList))
EnableAppList(initial_profile);

Powered by Google App Engine
This is Rietveld 408576698