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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Passing true for |always_create| means we won't duplicate the code that | 167 // Passing true for |always_create| means we won't duplicate the code that |
168 // tries to find a browser. | 168 // tries to find a browser. |
169 profiles::FindOrCreateNewWindowForProfile( | 169 profiles::FindOrCreateNewWindowForProfile( |
170 profile, | 170 profile, |
171 is_process_startup, | 171 is_process_startup, |
172 is_first_run, | 172 is_first_run, |
173 desktop_type, | 173 desktop_type, |
174 true); | 174 true); |
175 } | 175 } |
176 | 176 |
177 // Called after a |guest_profile| is available to be used by the user manager. | 177 // Called after a |system_profile| is available to be used by the user manager. |
178 // Based on the value of |tutorial_mode| we determine a url to be displayed | 178 // Based on the value of |tutorial_mode| we determine a url to be displayed |
179 // by the webui and run the |callback|, if it exists. After opening a profile, | 179 // by the webui and run the |callback|, if it exists. After opening a profile, |
180 // perform |profile_open_action|. | 180 // perform |profile_open_action|. |
181 void OnUserManagerGuestProfileCreated( | 181 void OnUserManagerSystemProfileCreated( |
182 const base::FilePath& profile_path_to_focus, | 182 const base::FilePath& profile_path_to_focus, |
183 profiles::UserManagerTutorialMode tutorial_mode, | 183 profiles::UserManagerTutorialMode tutorial_mode, |
184 profiles::UserManagerProfileSelected profile_open_action, | 184 profiles::UserManagerProfileSelected profile_open_action, |
185 const base::Callback<void(Profile*, const std::string&)>& callback, | 185 const base::Callback<void(Profile*, const std::string&)>& callback, |
186 Profile* guest_profile, | 186 Profile* system_profile, |
187 Profile::CreateStatus status) { | 187 Profile::CreateStatus status) { |
188 if (status != Profile::CREATE_STATUS_INITIALIZED || callback.is_null()) | 188 if (status != Profile::CREATE_STATUS_INITIALIZED || callback.is_null()) |
189 return; | 189 return; |
190 | 190 |
191 // Tell the webui which user should be focused. | 191 // Tell the webui which user should be focused. |
192 std::string page = chrome::kChromeUIUserManagerURL; | 192 std::string page = chrome::kChromeUIUserManagerURL; |
193 | 193 |
194 if (tutorial_mode == profiles::USER_MANAGER_TUTORIAL_OVERVIEW) { | 194 if (tutorial_mode == profiles::USER_MANAGER_TUTORIAL_OVERVIEW) { |
195 page += profiles::kUserManagerDisplayTutorial; | 195 page += profiles::kUserManagerDisplayTutorial; |
196 } else if (!profile_path_to_focus.empty()) { | 196 } else if (!profile_path_to_focus.empty()) { |
(...skipping 10 matching lines...) Expand all Loading... |
207 } else if (profile_open_action == | 207 } else if (profile_open_action == |
208 profiles::USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME) { | 208 profiles::USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME) { |
209 page += profiles::kUserManagerSelectProfileAboutChrome; | 209 page += profiles::kUserManagerSelectProfileAboutChrome; |
210 } else if (profile_open_action == | 210 } else if (profile_open_action == |
211 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS) { | 211 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS) { |
212 page += profiles::kUserManagerSelectProfileChromeSettings; | 212 page += profiles::kUserManagerSelectProfileChromeSettings; |
213 } else if (profile_open_action == | 213 } else if (profile_open_action == |
214 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY) { | 214 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY) { |
215 page += profiles::kUserManagerSelectProfileChromeMemory; | 215 page += profiles::kUserManagerSelectProfileChromeMemory; |
216 } | 216 } |
217 callback.Run(guest_profile, page); | 217 callback.Run(system_profile, page); |
218 } | 218 } |
219 | 219 |
220 // Updates Chrome services that require notification when | 220 // Updates Chrome services that require notification when |
221 // the new_profile_management's status changes. | 221 // the new_profile_management's status changes. |
222 void UpdateServicesWithNewProfileManagementFlag(Profile* profile, | 222 void UpdateServicesWithNewProfileManagementFlag(Profile* profile, |
223 bool new_flag_status) { | 223 bool new_flag_status) { |
224 AccountReconcilor* account_reconcilor = | 224 AccountReconcilor* account_reconcilor = |
225 AccountReconcilorFactory::GetForProfile(profile); | 225 AccountReconcilorFactory::GetForProfile(profile); |
226 account_reconcilor->OnNewProfileManagementFlagChanged(new_flag_status); | 226 account_reconcilor->OnNewProfileManagementFlagChanged(new_flag_status); |
227 } | 227 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return false; | 389 return false; |
390 } | 390 } |
391 | 391 |
392 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 392 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
393 if (cache.ProfileIsSupervisedAtIndex(i)) | 393 if (cache.ProfileIsSupervisedAtIndex(i)) |
394 return true; | 394 return true; |
395 } | 395 } |
396 return false; | 396 return false; |
397 } | 397 } |
398 | 398 |
399 void CreateGuestProfileForUserManager( | 399 void CreateSystemProfileForUserManager( |
400 const base::FilePath& profile_path_to_focus, | 400 const base::FilePath& profile_path_to_focus, |
401 profiles::UserManagerTutorialMode tutorial_mode, | 401 profiles::UserManagerTutorialMode tutorial_mode, |
402 profiles::UserManagerProfileSelected profile_open_action, | 402 profiles::UserManagerProfileSelected profile_open_action, |
403 const base::Callback<void(Profile*, const std::string&)>& callback) { | 403 const base::Callback<void(Profile*, const std::string&)>& callback) { |
404 // Create the guest profile, if necessary, and open the User Manager | 404 // Create the system profile, if necessary, and open the User Manager |
405 // from the guest profile. | 405 // from the system profile. |
406 g_browser_process->profile_manager()->CreateProfileAsync( | 406 g_browser_process->profile_manager()->CreateProfileAsync( |
407 ProfileManager::GetGuestProfilePath(), | 407 ProfileManager::GetSystemProfilePath(), |
408 base::Bind(&OnUserManagerGuestProfileCreated, | 408 base::Bind(&OnUserManagerSystemProfileCreated, |
409 profile_path_to_focus, | 409 profile_path_to_focus, |
410 tutorial_mode, | 410 tutorial_mode, |
411 profile_open_action, | 411 profile_open_action, |
412 callback), | 412 callback), |
413 base::string16(), | 413 base::string16(), |
414 base::string16(), | 414 base::string16(), |
415 std::string()); | 415 std::string()); |
416 } | 416 } |
417 | 417 |
418 void ShowUserManagerMaybeWithTutorial(Profile* profile) { | 418 void ShowUserManagerMaybeWithTutorial(Profile* profile) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 499 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
500 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 500 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
501 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 501 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
502 return; | 502 return; |
503 default: | 503 default: |
504 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 504 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 } // namespace profiles | 508 } // namespace profiles |
OLD | NEW |