#include "extensions/browser/extension_host.h"
#include <memory>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/elapsed_timer.h"
#include "components/input/native_web_keyboard_event.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/bad_message.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_error.h"
#include "extensions/browser/extension_host_delegate.h"
#include "extensions/browser/extension_host_observer.h"
#include "extensions/browser/extension_host_queue.h"
#include "extensions/browser/extension_host_registry.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/window_open_disposition.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/color_provider_source.h"
#include "ui/color/color_provider_utils.h"
RenderProcessHost;
SiteInstance;
WebContents;
namespace extensions {
namespace {
class NoOpColorProviderSource : public ui::ColorProviderSource { … };
void EmitDispatchTimeMetrics(const EventDispatchSource& dispatch_source,
base::TimeTicks dispatch_start_time,
bool lazy_background_active_on_dispatch,
const Extension* extension) { … }
}
ExtensionHost::ExtensionHost(const Extension* extension,
SiteInstance* site_instance,
const GURL& url,
mojom::ViewType host_type)
: … { … }
ExtensionHost::~ExtensionHost() { … }
content::RenderProcessHost* ExtensionHost::render_process_host() const { … }
bool ExtensionHost::IsRendererLive() const { … }
void ExtensionHost::CreateRendererSoon() { … }
void ExtensionHost::CreateRendererNow() { … }
void ExtensionHost::Close() { … }
void ExtensionHost::AddObserver(ExtensionHostObserver* observer) { … }
void ExtensionHost::RemoveObserver(ExtensionHostObserver* observer) { … }
void ExtensionHost::OnBackgroundEventDispatched(
const std::string& event_name,
base::TimeTicks dispatch_start_time,
int event_id,
EventDispatchSource dispatch_source,
bool lazy_background_active_on_dispatch) { … }
void ExtensionHost::OnNetworkRequestStarted(uint64_t request_id) { … }
void ExtensionHost::OnNetworkRequestDone(uint64_t request_id) { … }
void ExtensionHost::SetCloseHandler(CloseHandler close_handler) { … }
bool ExtensionHost::ShouldAllowNavigations() const { … }
const GURL& ExtensionHost::GetLastCommittedURL() const { … }
void ExtensionHost::LoadInitialURL() { … }
bool ExtensionHost::IsBackgroundPage() const { … }
void ExtensionHost::OnExtensionReady(content::BrowserContext* browser_context,
const Extension* extension) { … }
void ExtensionHost::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
void ExtensionHost::PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) { … }
void ExtensionHost::DidStopLoading() { … }
void ExtensionHost::OnDidStopFirstLoad() { … }
void ExtensionHost::PrimaryMainDocumentElementAvailable() { … }
void ExtensionHost::CloseContents(WebContents* contents) { … }
void ExtensionHost::EmitLateAckedEventTask(int event_id) { … }
void ExtensionHost::OnEventAck(int event_id,
bool event_has_listener_in_background_context) { … }
content::JavaScriptDialogManager* ExtensionHost::GetJavaScriptDialogManager(
WebContents* source) { … }
content::WebContents* ExtensionHost::AddNewContents(
WebContents* source,
std::unique_ptr<WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) { … }
void ExtensionHost::RenderFrameCreated(content::RenderFrameHost* frame_host) { … }
void ExtensionHost::RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) { … }
void ExtensionHost::MaybeNotifyRenderProcessReady() { … }
void ExtensionHost::NotifyRenderProcessReady() { … }
void ExtensionHost::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) { … }
bool ExtensionHost::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type) { … }
bool ExtensionHost::IsNeverComposited(content::WebContents* web_contents) { … }
content::PictureInPictureResult ExtensionHost::EnterPictureInPicture(
content::WebContents* web_contents) { … }
void ExtensionHost::ExitPictureInPicture() { … }
std::string ExtensionHost::GetTitleForMediaControls(
content::WebContents* web_contents) { … }
void ExtensionHost::RecordStopLoadingUMA() { … }
}