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

Side by Side Diff: chrome/browser/profiles/profile_window.cc

Issue 132453004: Add Profile metric counting to new User Manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added new metric information to xml file Created 6 years, 10 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 | Annotate | Revision Log
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/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 "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 content::RecordAction(UserMetricsAction("NewWindow")); 117 content::RecordAction(UserMetricsAction("NewWindow"));
118 CommandLine command_line(CommandLine::NO_PROGRAM); 118 CommandLine command_line(CommandLine::NO_PROGRAM);
119 int return_code; 119 int return_code;
120 StartupBrowserCreator browser_creator; 120 StartupBrowserCreator browser_creator;
121 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), 121 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
122 process_startup, is_first_run, &return_code); 122 process_startup, is_first_run, &return_code);
123 #endif // defined(OS_IOS) 123 #endif // defined(OS_IOS)
124 } 124 }
125 125
126 void SwitchToProfile( 126 void SwitchToProfile(const base::FilePath& path,
127 const base::FilePath& path, 127 chrome::HostDesktopType desktop_type,
128 chrome::HostDesktopType desktop_type, 128 bool always_create,
129 bool always_create, 129 ProfileSwitchingDoneCallback callback,
130 ProfileSwitchingDoneCallback callback) { 130 ProfileMetrics::ProfileOpen metric) {
131 g_browser_process->profile_manager()->CreateProfileAsync( 131 g_browser_process->profile_manager()->CreateProfileAsync(
132 path, 132 path,
133 base::Bind(&OpenBrowserWindowForProfile, 133 base::Bind(&OpenBrowserWindowForProfile,
134 callback, 134 callback,
135 always_create, 135 always_create,
136 false, 136 false,
137 desktop_type), 137 desktop_type),
138 base::string16(), 138 base::string16(),
139 base::string16(), 139 base::string16(),
140 std::string()); 140 std::string());
141 ProfileMetrics::LogProfileSwitchUser(metric);
141 } 142 }
142 143
143 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, 144 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type,
144 ProfileSwitchingDoneCallback callback) { 145 ProfileSwitchingDoneCallback callback) {
145 g_browser_process->profile_manager()->CreateProfileAsync( 146 g_browser_process->profile_manager()->CreateProfileAsync(
146 ProfileManager::GetGuestProfilePath(), 147 ProfileManager::GetGuestProfilePath(),
147 base::Bind(&OpenBrowserWindowForProfile, 148 base::Bind(&OpenBrowserWindowForProfile,
148 callback, 149 callback,
149 false, 150 false,
150 false, 151 false,
151 desktop_type), 152 desktop_type),
152 base::string16(), 153 base::string16(),
153 base::string16(), 154 base::string16(),
154 std::string()); 155 std::string());
156 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST);
155 } 157 }
156 158
157 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, 159 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
158 ProfileSwitchingDoneCallback callback) { 160 ProfileSwitchingDoneCallback callback,
161 ProfileMetrics::ProfileAdd metric) {
159 ProfileManager::CreateMultiProfileAsync( 162 ProfileManager::CreateMultiProfileAsync(
160 base::string16(), 163 base::string16(),
161 base::string16(), 164 base::string16(),
162 base::Bind(&OpenBrowserWindowForProfile, 165 base::Bind(&OpenBrowserWindowForProfile,
163 callback, 166 callback,
164 true, 167 true,
165 true, 168 true,
166 desktop_type), 169 desktop_type),
167 std::string()); 170 std::string());
171 ProfileMetrics::LogProfileAddNewUser(metric);
168 } 172 }
169 173
170 void CloseGuestProfileWindows() { 174 void CloseGuestProfileWindows() {
171 ProfileManager* profile_manager = g_browser_process->profile_manager(); 175 ProfileManager* profile_manager = g_browser_process->profile_manager();
172 Profile* profile = profile_manager->GetProfileByPath( 176 Profile* profile = profile_manager->GetProfileByPath(
173 ProfileManager::GetGuestProfilePath()); 177 ProfileManager::GetGuestProfilePath());
174 178
175 if (profile) { 179 if (profile) {
176 BrowserList::CloseAllBrowsersWithProfile(profile); 180 BrowserList::CloseAllBrowsersWithProfile(profile);
177 } 181 }
178 } 182 }
179 183
180 void LockProfile(Profile* profile) { 184 void LockProfile(Profile* profile) {
181 DCHECK(profile); 185 DCHECK(profile);
182 ProfileInfoCache& cache = 186 ProfileInfoCache& cache =
183 g_browser_process->profile_manager()->GetProfileInfoCache(); 187 g_browser_process->profile_manager()->GetProfileInfoCache();
184 188
185 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 189 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
186 cache.SetProfileSigninRequiredAtIndex(index, true); 190 cache.SetProfileSigninRequiredAtIndex(index, true);
187 chrome::ShowUserManager(profile->GetPath()); 191 chrome::ShowUserManager(profile->GetPath());
188 BrowserList::CloseAllBrowsersWithProfile(profile); 192 BrowserList::CloseAllBrowsersWithProfile(profile);
189 } 193 }
190 194
191 } // namespace profiles 195 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698