Index: chrome/browser/profiles/profile_window.cc |
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc |
index bd0d533fd215ae552e91e75ee1d62fcf42c1c468..6d4ebb8227b4b8aa0b00d188328a88f7c8e2fff1 100644 |
--- a/chrome/browser/profiles/profile_window.cc |
+++ b/chrome/browser/profiles/profile_window.cc |
@@ -6,11 +6,13 @@ |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
+#include "base/strings/string_number_conversions.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_dialogs.h" |
+#include "chrome/common/url_constants.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/user_metrics.h" |
@@ -118,6 +120,34 @@ void OpenBrowserWindowForProfile( |
true); |
} |
+void OnUserManagerGuestProfileCreated( |
Alexei Svitkine (slow)
2014/03/18 15:50:33
Add a comment.
noms (inactive)
2014/03/19 15:58:20
Done.
|
+ const base::FilePath& profile_path_to_focus, |
+ profiles::UserManagerTutorialMode tutorial_mode, |
+ const base::Callback<void(Profile*, const std::string&)>& callback, |
+ Profile* guest_profile, |
+ Profile::CreateStatus status) { |
+ if (status != Profile::CREATE_STATUS_INITIALIZED) |
+ return; |
+ |
+ // Tell the webui which user pod should be focused. |
+ std::string page = chrome::kChromeUIUserManagerURL; |
+ |
+ if (tutorial_mode == profiles::USER_MANAGER_TUTORIAL_OVERVIEW) { |
+ page += "#tutorial"; |
+ } else if (!profile_path_to_focus.empty()) { |
+ ProfileInfoCache& cache = |
Alexei Svitkine (slow)
2014/03/18 15:50:33
Nit: const
noms (inactive)
2014/03/19 15:58:20
Done.
Alexei Svitkine (slow)
2014/03/19 16:37:01
Optional nit: I think in this case you should be a
|
+ g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ size_t index = cache.GetIndexOfProfileWithPath(profile_path_to_focus); |
+ if (index != std::string::npos) { |
+ page += "#"; |
+ page += base::IntToString(index); |
+ } |
+ } |
+ |
+ if (!callback.is_null()) |
+ callback.Run(guest_profile, page); |
+} |
+ |
} // namespace |
namespace profiles { |
@@ -219,4 +249,23 @@ void LockProfile(Profile* profile) { |
BrowserList::CloseAllBrowsersWithProfile(profile); |
} |
+void CreateGuestProfileForUserManager( |
+ const base::FilePath& profile_path_to_focus, |
+ profiles::UserManagerTutorialMode tutorial_mode, |
+ const base::Callback<void(Profile*, const std::string&)>& callback) { |
+ |
+ // Create the guest profile, if necessary, and open the User Manager |
+ // from the guest profile. |
+ ProfileManager* profile_manager = g_browser_process->profile_manager(); |
+ profile_manager->CreateProfileAsync( |
+ ProfileManager::GetGuestProfilePath(), |
+ base::Bind(&OnUserManagerGuestProfileCreated, |
+ profile_path_to_focus, |
+ tutorial_mode, |
+ callback), |
+ base::string16(), |
Alexei Svitkine (slow)
2014/03/18 15:50:33
Nit: Can you add /* */ comments with the name of t
noms (inactive)
2014/03/19 15:58:20
This is a pretty standard call for this function (
|
+ base::string16(), |
+ std::string()); |
+} |
+ |
} // namespace profiles |