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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 344883002: Collect UMA statistics on which chrome://flags lead to chrome restart on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug in about_flags.cc. Sdded comments. s/restarting/custom/ Created 6 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
34 #include "chrome/browser/browser_shutdown.h" 34 #include "chrome/browser/browser_shutdown.h"
35 #include "chrome/browser/chrome_notification_types.h" 35 #include "chrome/browser/chrome_notification_types.h"
36 #include "chrome/browser/chromeos/boot_times_loader.h" 36 #include "chrome/browser/chromeos/boot_times_loader.h"
37 #include "chrome/browser/chromeos/login/auth/parallel_authenticator.h" 37 #include "chrome/browser/chromeos/login/auth/parallel_authenticator.h"
38 #include "chrome/browser/chromeos/login/auth/user_context.h" 38 #include "chrome/browser/chromeos/login/auth/user_context.h"
39 #include "chrome/browser/chromeos/login/chrome_restart_request.h" 39 #include "chrome/browser/chromeos/login/chrome_restart_request.h"
40 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" 40 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
41 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 41 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
42 #include "chrome/browser/chromeos/login/profile_auth_data.h" 42 #include "chrome/browser/chromeos/login/profile_auth_data.h"
43 #include "chrome/browser/chromeos/login/report_custom_flags.h"
43 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" 44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h" 45 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h"
45 #include "chrome/browser/chromeos/login/session/session_manager.h" 46 #include "chrome/browser/chromeos/login/session/session_manager.h"
46 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" 47 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
47 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" 48 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h"
48 #include "chrome/browser/chromeos/login/startup_utils.h" 49 #include "chrome/browser/chromeos/login/startup_utils.h"
49 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" 50 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
50 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 51 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
51 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 52 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
52 #include "chrome/browser/chromeos/login/users/user.h" 53 #include "chrome/browser/chromeos/login/users/user.h"
(...skipping 25 matching lines...) Expand all
78 #include "components/signin/core/browser/signin_manager.h" 79 #include "components/signin/core/browser/signin_manager.h"
79 #include "content/public/browser/browser_thread.h" 80 #include "content/public/browser/browser_thread.h"
80 #include "content/public/browser/notification_service.h" 81 #include "content/public/browser/notification_service.h"
81 #include "google_apis/gaia/gaia_auth_consumer.h" 82 #include "google_apis/gaia/gaia_auth_consumer.h"
82 #include "net/base/network_change_notifier.h" 83 #include "net/base/network_change_notifier.h"
83 #include "net/url_request/url_request_context.h" 84 #include "net/url_request/url_request_context.h"
84 #include "net/url_request/url_request_context_getter.h" 85 #include "net/url_request/url_request_context_getter.h"
85 #include "url/gurl.h" 86 #include "url/gurl.h"
86 87
87 using content::BrowserThread; 88 using content::BrowserThread;
88
89 namespace chromeos { 89 namespace chromeos {
90 90
91 struct DoBrowserLaunchOnLocaleLoadedData; 91 struct DoBrowserLaunchOnLocaleLoadedData;
92 92
93 class LoginUtilsImpl 93 class LoginUtilsImpl
94 : public LoginUtils, 94 : public LoginUtils,
95 public base::SupportsWeakPtr<LoginUtilsImpl>, 95 public base::SupportsWeakPtr<LoginUtilsImpl>,
96 public SessionManager::Delegate { 96 public SessionManager::Delegate {
97 public: 97 public:
98 LoginUtilsImpl() 98 LoginUtilsImpl()
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 LoginDisplayHost* login_host) { 209 LoginDisplayHost* login_host) {
210 if (!UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) { 210 if (!UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) {
211 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile); 211 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile);
212 return; 212 return;
213 } 213 }
214 214
215 CommandLine user_flags(CommandLine::NO_PROGRAM); 215 CommandLine user_flags(CommandLine::NO_PROGRAM);
216 about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs()); 216 about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs());
217 about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags, 217 about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags,
218 about_flags::kAddSentinels); 218 about_flags::kAddSentinels);
219
220 // about_flags::AreSwitchesIdenticalToCurrentCommandLine() requires
221 // output argument to be std::set<CommandLine::StringType>* .
222 // To report the difference, we need std::set<std::string> .
223 // So here we are silently using the fact, that CommandLine::StringType
224 // is std::string on ChromeOS. Otherwise we would have to decode strings here.
225 std::set<std::string> command_line_difference;
226
219 // Only restart if needed and if not going into managed mode. 227 // Only restart if needed and if not going into managed mode.
220 // Don't restart browser if it is not first profile in session. 228 // Don't restart browser if it is not first profile in session.
221 if (UserManager::Get()->GetLoggedInUsers().size() == 1 && 229 if (UserManager::Get()->GetLoggedInUsers().size() == 1 &&
222 !UserManager::Get()->IsLoggedInAsLocallyManagedUser() && 230 !UserManager::Get()->IsLoggedInAsLocallyManagedUser() &&
223 !about_flags::AreSwitchesIdenticalToCurrentCommandLine( 231 !about_flags::AreSwitchesIdenticalToCurrentCommandLine(
224 user_flags, *CommandLine::ForCurrentProcess())) { 232 user_flags,
233 *CommandLine::ForCurrentProcess(),
234 &command_line_difference)) {
225 CommandLine::StringVector flags; 235 CommandLine::StringVector flags;
226 // argv[0] is the program name |CommandLine::NO_PROGRAM|. 236 // argv[0] is the program name |CommandLine::NO_PROGRAM|.
227 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); 237 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end());
228 VLOG(1) << "Restarting to apply per-session flags..."; 238 VLOG(1) << "Restarting to apply per-session flags...";
239
240 ReportCustomFlags(command_line_difference);
241
229 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( 242 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser(
230 UserManager::Get()->GetActiveUser()->email(), flags); 243 UserManager::Get()->GetActiveUser()->email(), flags);
231 AttemptRestart(profile); 244 AttemptRestart(profile);
232 return; 245 return;
233 } 246 }
234 247
235 if (login_host) { 248 if (login_host) {
236 login_host->SetStatusAreaVisible(true); 249 login_host->SetStatusAreaVisible(true);
237 login_host->BeforeSessionStart(); 250 login_host->BeforeSessionStart();
238 } 251 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 CrosSettings* cros_settings = CrosSettings::Get(); 413 CrosSettings* cros_settings = CrosSettings::Get();
401 bool allow_new_user = false; 414 bool allow_new_user = false;
402 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 415 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
403 if (allow_new_user) 416 if (allow_new_user)
404 return true; 417 return true;
405 return cros_settings->FindEmailInList( 418 return cros_settings->FindEmailInList(
406 kAccountsPrefUsers, username, wildcard_match); 419 kAccountsPrefUsers, username, wildcard_match);
407 } 420 }
408 421
409 } // namespace chromeos 422 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698