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

Side by Side 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: small fixups Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 5 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
6 6
7 #include "apps/pref_names.h" 7 #include "apps/pref_names.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 22
22 namespace { 23 namespace {
23 24
24 void SendAppListAppLaunch(int count) { 25 void SendAppListAppLaunch(int count) {
25 UMA_HISTOGRAM_CUSTOM_COUNTS( 26 UMA_HISTOGRAM_CUSTOM_COUNTS(
26 "Apps.AppListDailyAppLaunches", count, 1, 1000, 50); 27 "Apps.AppListDailyAppLaunches", count, 1, 1000, 50);
27 if (count > 0) 28 if (count > 0)
28 UMA_HISTOGRAM_ENUMERATION("Apps.AppListHasLaunchedAppToday", 1, 2); 29 UMA_HISTOGRAM_ENUMERATION("Apps.AppListHasLaunchedAppToday", 1, 2);
29 } 30 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 Profile* AppListServiceImpl::GetCurrentAppListProfile() { 193 Profile* AppListServiceImpl::GetCurrentAppListProfile() {
193 return profile(); 194 return profile();
194 } 195 }
195 196
196 void AppListServiceImpl::SetProfile(Profile* new_profile) { 197 void AppListServiceImpl::SetProfile(Profile* new_profile) {
197 registrar_.RemoveAll(); 198 registrar_.RemoveAll();
198 profile_ = new_profile; 199 profile_ = new_profile;
199 if (!profile_) 200 if (!profile_)
200 return; 201 return;
201 202
203 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
204 content::NotificationService::AllSources());
202 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 205 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
203 content::Source<Profile>(profile_)); 206 content::Source<Profile>(profile_));
204 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, 207 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED,
205 content::Source<Profile>(profile_)); 208 content::Source<Profile>(profile_));
206 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, 209 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
207 content::Source<Profile>(profile_)); 210 content::Source<Profile>(profile_));
208 } 211 }
209 212
210 void AppListServiceImpl::InvalidatePendingProfileLoads() { 213 void AppListServiceImpl::InvalidatePendingProfileLoads() {
211 profile_loader_.InvalidatePendingProfileLoads(); 214 profile_loader_.InvalidatePendingProfileLoads();
212 } 215 }
213 216
217 void AppListServiceImpl::ShowForProfileByPath(base::FilePath profile_path) {
218 profile_loader().LoadProfileInvalidatingOtherLoads(
219 profile_path,
220 base::Bind(&AppListServiceImpl::ShowForProfile,
221 weak_factory_.GetWeakPtr()));
222 }
223
214 void AppListServiceImpl::HandleCommandLineFlags(Profile* initial_profile) { 224 void AppListServiceImpl::HandleCommandLineFlags(Profile* initial_profile) {
215 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppList)) 225 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppList))
216 EnableAppList(initial_profile); 226 EnableAppList(initial_profile);
217 227
218 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppList)) 228 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppList))
219 SetAppListEnabledPreference(false); 229 SetAppListEnabledPreference(false);
220 } 230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698