| Index: chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
|
| diff --git a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
|
| index 7c67ded9c5dfd5f06dd74ccc83b2d1e1d9494f8a..512d920bed70134989f76e6a4349e0decf595319 100644
|
| --- a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
|
| +++ b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
|
| @@ -7,11 +7,16 @@
|
| #include <algorithm>
|
| #include <set>
|
|
|
| +#include "base/stl_util.h"
|
| +#include "base/strings/string_split.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
|
| #include "components/password_manager/core/browser/password_manager_internals_service.h"
|
| +#include "components/password_manager/core/common/password_manager_pref_names.h"
|
| +#include "components/prefs/pref_service.h"
|
| +#include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_ui.h"
|
| #include "content/public/browser/web_ui_data_source.h"
|
| #include "grit/password_manager_internals_resources.h"
|
| @@ -73,6 +78,18 @@ void PasswordManagerInternalsUI::DidStopLoading() {
|
| std::string past_logs(service->RegisterReceiver(this));
|
| LogSavePasswordProgress(past_logs);
|
| }
|
| +
|
| + // Reset the first run experience for auto sign-in if the user opened
|
| + // chrome://password-manager-internals/?reset_fre .
|
| + // TODO(crbug.com/599454) This may be removed in M53, when the credential
|
| + // manager API has been launched to stable.
|
| + GURL url = web_ui()->GetWebContents()->GetVisibleURL();
|
| + if (url.is_valid() && url.has_query()) {
|
| + std::vector<std::string> query_parameters = base::SplitString(
|
| + url.query(), "&", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
|
| + if (ContainsValue(query_parameters, "reset_fre"))
|
| + ResetAutoSignInFirstRunExperience();
|
| + }
|
| }
|
|
|
| void PasswordManagerInternalsUI::LogSavePasswordProgress(
|
| @@ -96,3 +113,17 @@ void PasswordManagerInternalsUI::UnregisterFromLoggingServiceIfNecessary() {
|
| if (service)
|
| service->UnregisterReceiver(this);
|
| }
|
| +
|
| +void PasswordManagerInternalsUI::ResetAutoSignInFirstRunExperience() {
|
| + Profile* profile = Profile::FromWebUI(web_ui());
|
| + if (profile->GetProfileType() == Profile::REGULAR_PROFILE) {
|
| + profile->GetPrefs()->SetBoolean(
|
| + password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false);
|
| +
|
| + PasswordManagerInternalsService* service =
|
| + PasswordManagerInternalsServiceFactory::GetForBrowserContext(
|
| + Profile::FromWebUI(web_ui()));
|
| + if (service)
|
| + service->ProcessLog("Reset auto sign-in first run experience: yes");
|
| + }
|
| +}
|
|
|