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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index fafe4398fe5abc26626f9aadd4c18c42f612460f..e13a94d8a45c3909d77180b514dc854ffc16eb59 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/profile_auth_data.h"
+#include "chrome/browser/chromeos/login/report_restarting_flags.h"
#include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
#include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory.h"
#include "chrome/browser/chromeos/login/session/session_manager.h"
@@ -85,7 +86,6 @@
#include "url/gurl.h"
using content::BrowserThread;
-
namespace chromeos {
struct DoBrowserLaunchOnLocaleLoadedData;
@@ -216,16 +216,29 @@ void LoginUtilsImpl::DoBrowserLaunchOnLocaleLoadedImpl(
about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs());
about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags,
about_flags::kAddSentinels);
+
+ // about_flags::AreSwitchesIdenticalToCurrentCommandLine() requires
+ // output argument to be std::set<CommandLine::StringType>* .
+ // To report the difference, we need std::set<std::string> .
+ // So here we are silently using the fact, that CommandLine::StringType
+ // is std::string on ChromeOS. Otherwise we would have to decode strings here.
+ std::set<std::string> command_line_difference;
+
// Only restart if needed and if not going into managed mode.
// Don't restart browser if it is not first profile in session.
if (UserManager::Get()->GetLoggedInUsers().size() == 1 &&
!UserManager::Get()->IsLoggedInAsLocallyManagedUser() &&
!about_flags::AreSwitchesIdenticalToCurrentCommandLine(
- user_flags, *CommandLine::ForCurrentProcess())) {
+ user_flags,
+ *CommandLine::ForCurrentProcess(),
+ &command_line_difference)) {
CommandLine::StringVector flags;
// argv[0] is the program name |CommandLine::NO_PROGRAM|.
flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end());
VLOG(1) << "Restarting to apply per-session flags...";
+
+ ReportRestartingFlags(command_line_difference);
+
DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser(
UserManager::Get()->GetActiveUser()->email(), flags);
AttemptRestart(profile);

Powered by Google App Engine
This is Rietveld 408576698