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

Unified Diff: chrome/browser/ui/cocoa/user_manager_mac.mm

Issue 199533004: [Mac, Win] Show a user manager tutorial once per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rachel nits Created 6 years, 9 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/cocoa/user_manager_mac.mm
diff --git a/chrome/browser/ui/cocoa/user_manager_mac.mm b/chrome/browser/ui/cocoa/user_manager_mac.mm
index 1e132eb9bdf5584f48137acfe4e48598bd177e33..fc2b9f5f247c3607b5a90aec2183ac9f26b48eb0 100644
--- a/chrome/browser/ui/cocoa/user_manager_mac.mm
+++ b/chrome/browser/ui/cocoa/user_manager_mac.mm
@@ -4,11 +4,9 @@
#include "chrome/browser/ui/cocoa/user_manager_mac.h"
-#include "base/strings/string_number_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/common/url_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "grit/generated_resources.h"
@@ -25,7 +23,12 @@ namespace chrome {
// Declared in browser_dialogs.h so others don't have to depend on this header.
void ShowUserManager(const base::FilePath& profile_path_to_focus) {
- UserManagerMac::Show(profile_path_to_focus);
+ UserManagerMac::Show(
+ profile_path_to_focus, profiles::USER_MANAGER_NO_TUTORIAL);
+}
+
+void ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) {
+ UserManagerMac::Show(base::FilePath(), tutorial);
}
void HideUserManager() {
@@ -135,22 +138,20 @@ UserManagerMac::~UserManagerMac() {
}
// static
-void UserManagerMac::Show(const base::FilePath& profile_path_to_focus) {
+void UserManagerMac::Show(const base::FilePath& profile_path_to_focus,
+ profiles::UserManagerTutorialMode tutorial_mode) {
if (instance_) {
+ // If there's a user manager window open already, just activate it.
[instance_->window_controller_ show];
return;
}
- // Create the guest profile, if necessary, and open the User Manager
+ // Create the guest profile, if necessary, and open the user manager
msw 2014/03/20 18:51:26 nit: if you are trying to make these consistently
noms (inactive) 2014/03/20 20:28:20 I don't think I was on purpose. Recapitalized. On
// from the guest profile.
- ProfileManager* profile_manager = g_browser_process->profile_manager();
- profile_manager->CreateProfileAsync(
- ProfileManager::GetGuestProfilePath(),
- base::Bind(&UserManagerMac::OnGuestProfileCreated,
- profile_path_to_focus),
- base::string16(),
- base::string16(),
- std::string());
+ profiles::CreateGuestProfileForUserManager(
+ profile_path_to_focus,
+ tutorial_mode,
+ base::Bind(&UserManagerMac::OnGuestProfileCreated));
}
// static
@@ -164,32 +165,14 @@ bool UserManagerMac::IsShowing() {
return instance_ ? [instance_->window_controller_ isVisible]: false;
}
+// static
+void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile,
msw 2014/03/20 18:51:26 nit: the ordering of these functions still doesn't
+ const std::string& url) {
+ instance_ = new UserManagerMac(guest_profile);
+ [instance_->window_controller_ showURL:GURL(url)];
+}
+
void UserManagerMac::WindowWasClosed() {
instance_ = NULL;
delete this;
}
-
-void UserManagerMac::OnGuestProfileCreated(
- const base::FilePath& profile_path_to_focus,
- Profile* guest_profile,
- Profile::CreateStatus status) {
- if (status != Profile::CREATE_STATUS_INITIALIZED)
- return;
-
- instance_ = new UserManagerMac(guest_profile);
-
- // Tell the webui which user pod should be focused.
- std::string page = chrome::kChromeUIUserManagerURL;
-
- if (!profile_path_to_focus.empty()) {
- ProfileInfoCache& cache =
- 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);
- }
- }
- [instance_->window_controller_ showURL:GURL(page)];
-}
-

Powered by Google App Engine
This is Rietveld 408576698