#include "chrome/browser/extensions/extension_web_ui.h"
#include <stddef.h>
#include <iterator>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/favicon_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/bindings_policy.h"
#include "extensions/browser/extension_icon_placeholder.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/image_loader.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "net/base/file_stream.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/resource/resource_scale_factor.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
WebContents;
Extension;
URLOverrides;
namespace {
const char kEntry[] = …;
const char kActive[] = …;
void InitializeOverridesList(base::Value::List& list) { … }
void AddOverridesToList(base::Value::List& list, const GURL& override_url) { … }
void ValidateOverridesList(const extensions::ExtensionSet* all_extensions,
base::Value::List& list) { … }
void UnregisterAndReplaceOverrideForWebContents(const std::string& page,
Profile* profile,
WebContents* web_contents) { … }
enum UpdateBehavior { … };
bool UpdateOverridesList(base::Value::List& overrides_list,
const std::string& override_url,
UpdateBehavior behavior) { … }
void UpdateOverridesLists(Profile* profile,
const URLOverrides::URLOverrideMap& overrides,
UpdateBehavior behavior) { … }
void RunFaviconCallbackAsync(favicon_base::FaviconResultsCallback callback,
const gfx::Image& image) { … }
const Extension* ValidateOverrideURL(const base::Value* override_url_value,
const GURL& source_url,
const extensions::ExtensionSet& extensions,
GURL* override_url) { … }
void ForEachOverrideList(
Profile* profile,
base::RepeatingCallback<void(base::Value::List&)> callback) { … }
std::vector<GURL> GetOverridesForChromeURL(
const GURL& url,
content::BrowserContext* browser_context,
bool get_all) { … }
}
const char ExtensionWebUI::kExtensionURLOverrides[] = …;
void ExtensionWebUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
bool ExtensionWebUI::HandleChromeURLOverride(
GURL* url,
content::BrowserContext* browser_context) { … }
bool ExtensionWebUI::HandleChromeURLOverrideReverse(
GURL* url, content::BrowserContext* browser_context) { … }
const extensions::Extension* ExtensionWebUI::GetExtensionControllingURL(
const GURL& url,
content::BrowserContext* browser_context) { … }
size_t ExtensionWebUI::GetNumberOfExtensionsOverridingURL(
const GURL& url,
content::BrowserContext* browser_context) { … }
void ExtensionWebUI::InitializeChromeURLOverrides(Profile* profile) { … }
void ExtensionWebUI::ValidateChromeURLOverrides(Profile* profile) { … }
void ExtensionWebUI::RegisterOrActivateChromeURLOverrides(
Profile* profile,
const URLOverrides::URLOverrideMap& overrides) { … }
void ExtensionWebUI::DeactivateChromeURLOverrides(
Profile* profile,
const URLOverrides::URLOverrideMap& overrides) { … }
void ExtensionWebUI::UnregisterChromeURLOverrides(
Profile* profile,
const URLOverrides::URLOverrideMap& overrides) { … }
void ExtensionWebUI::GetFaviconForURL(
Profile* profile,
const GURL& page_url,
favicon_base::FaviconResultsCallback callback) { … }