OLD | NEW |
---|---|
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" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 } | 141 } |
142 | 142 |
143 // If there is no last used profile recorded, use the initial profile. | 143 // If there is no last used profile recorded, use the initial profile. |
144 if (app_list_profile.empty()) | 144 if (app_list_profile.empty()) |
145 app_list_profile = chrome::kInitialProfile; | 145 app_list_profile = chrome::kInitialProfile; |
146 | 146 |
147 return user_data_dir.AppendASCII(app_list_profile); | 147 return user_data_dir.AppendASCII(app_list_profile); |
148 } | 148 } |
149 | 149 |
150 void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) { | 150 void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) { |
151 // Ensure we don't set the pref to a managed user's profile path. | |
koz (OOO until 15th September)
2013/09/25 23:35:58
Is this ever expected to be hit? If not it should
tapted
2013/09/26 03:52:50
Calamity can confirm, but I'm pretty sure this is
| |
152 ProfileInfoCache& profile_info = | |
153 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
154 size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path); | |
155 if (profile_info.ProfileIsManagedAtIndex(profile_index)) | |
156 return; | |
157 | |
151 g_browser_process->local_state()->SetString( | 158 g_browser_process->local_state()->SetString( |
152 prefs::kAppListProfile, | 159 prefs::kAppListProfile, |
153 profile_path.BaseName().MaybeAsASCII()); | 160 profile_path.BaseName().MaybeAsASCII()); |
154 } | 161 } |
155 | 162 |
156 void AppListServiceImpl::CreateShortcut() {} | 163 void AppListServiceImpl::CreateShortcut() {} |
157 | 164 |
158 // We need to watch for profile removal to keep kAppListProfile updated. | 165 // We need to watch for profile removal to keep kAppListProfile updated. |
159 void AppListServiceImpl::OnProfileWillBeRemoved( | 166 void AppListServiceImpl::OnProfileWillBeRemoved( |
160 const base::FilePath& profile_path) { | 167 const base::FilePath& profile_path) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppList)) | 211 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppList)) |
205 SetAppListEnabledPreference(false); | 212 SetAppListEnabledPreference(false); |
206 | 213 |
207 // Send app list usage stats after a delay. | 214 // Send app list usage stats after a delay. |
208 const int kSendUsageStatsDelay = 5; | 215 const int kSendUsageStatsDelay = 5; |
209 base::MessageLoop::current()->PostDelayedTask( | 216 base::MessageLoop::current()->PostDelayedTask( |
210 FROM_HERE, | 217 FROM_HERE, |
211 base::Bind(&AppListServiceImpl::SendAppListStats), | 218 base::Bind(&AppListServiceImpl::SendAppListStats), |
212 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); | 219 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); |
213 } | 220 } |
OLD | NEW |