#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.h"
#include "base/check_deref.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/json/json_writer.h"
#include "base/not_fatal_until.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service_factory.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_service_factory.h"
#include "chrome/browser/ui/webui/search_engine_choice/icon_utils.h"
#include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/search_engine_choice_resources.h"
#include "chrome/grit/search_engine_choice_resources_map.h"
#include "chrome/grit/signin_resources.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_service.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_utils.h"
#include "components/search_engines/template_url.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/strings/grit/components_branded_strings.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
namespace {
std::string GetChoiceListJSON(Profile& profile) { … }
}
SearchEngineChoiceUI::SearchEngineChoiceUI(content::WebUI* web_ui)
: … { … }
WEB_UI_CONTROLLER_TYPE_IMPL(SearchEngineChoiceUI)
SearchEngineChoiceUI::~SearchEngineChoiceUI() = default;
void SearchEngineChoiceUI::BindInterface(
mojo::PendingReceiver<search_engine_choice::mojom::PageHandlerFactory>
receiver) { … }
void SearchEngineChoiceUI::Initialize(
base::OnceClosure display_dialog_callback,
base::OnceClosure on_choice_made_callback,
SearchEngineChoiceDialogService::EntryPoint entry_point) { … }
void SearchEngineChoiceUI::HandleSearchEngineChoiceMade(int prepopulate_id) { … }
void SearchEngineChoiceUI::HandleLearnMoreLinkClicked() { … }
void SearchEngineChoiceUI::HandleMoreButtonClicked() { … }
void SearchEngineChoiceUI::CreatePageHandler(
mojo::PendingReceiver<search_engine_choice::mojom::PageHandler> receiver) { … }