#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h"
#include <utility>
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/channel_info.h"
#include "components/autofill/core/browser/logging/log_router.h"
#include "components/embedder_support/user_agent_utils.h"
#include "components/grit/dev_ui_components_resources.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
#include "components/version_ui/version_handler_helper.h"
#include "components/version_ui/version_ui_constants.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browsing_data_filter_builder.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/password_manager/android/password_manager_eviction_util.h"
#endif
LogRouter;
namespace autofill {
void CreateAndAddInternalsHTMLSource(Profile* profile,
const std::string& source_name) { … }
AutofillCacheResetter::AutofillCacheResetter(
content::BrowserContext* browser_context)
: … { … }
AutofillCacheResetter::~AutofillCacheResetter() { … }
void AutofillCacheResetter::ResetCache(Callback callback) { … }
void AutofillCacheResetter::OnBrowsingDataRemoverDone(
uint64_t failed_data_types) { … }
InternalsUIHandler::InternalsUIHandler(
std::string call_on_load,
GetLogRouterFunction get_log_router_function)
: … { … }
InternalsUIHandler::~InternalsUIHandler() { … }
void InternalsUIHandler::RegisterMessages() { … }
void InternalsUIHandler::OnJavascriptAllowed() { … }
void InternalsUIHandler::OnJavascriptDisallowed() { … }
void InternalsUIHandler::OnLoaded(const base::Value::List& args) { … }
void InternalsUIHandler::OnResetCache(const base::Value::List& args) { … }
void InternalsUIHandler::OnResetCacheDone(const std::string& message) { … }
#if BUILDFLAG(IS_ANDROID)
void InternalsUIHandler::OnResetUpmEviction(const base::Value::List& args) {
auto* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
bool is_user_unenrolled =
password_manager_upm_eviction::IsCurrentUserEvicted(prefs);
if (is_user_unenrolled) {
prefs->ClearPref(password_manager::prefs::
kUnenrolledFromGoogleMobileServicesDueToErrors);
} else {
prefs->SetBoolean(
password_manager::prefs::kUnenrolledFromGoogleMobileServicesDueToErrors,
true);
prefs->SetInteger(
password_manager::prefs::kCurrentMigrationVersionToGoogleMobileServices,
0);
prefs->SetDouble(password_manager::prefs::kTimeOfLastMigrationAttempt, 0.0);
}
FireWebUIListener("enable-reset-upm-eviction-button",
base::Value(!is_user_unenrolled));
}
void InternalsUIHandler::OnResetAccountStorageNotice(
const base::Value::List& args) {
Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref(
password_manager::prefs::kAccountStorageNoticeShown);
}
#endif
void InternalsUIHandler::StartSubscription() { … }
void InternalsUIHandler::EndSubscription() { … }
void InternalsUIHandler::LogEntry(const base::Value::Dict& entry) { … }
}