#include "chrome/browser/extensions/permissions/active_tab_permission_granter.h"
#include <set>
#include <vector>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/network_permissions_updater.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/script_injection_tracker.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "extensions/common/mojom/renderer.mojom.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/url_pattern_set.h"
#include "extensions/common/user_script.h"
#include "url/gurl.h"
namespace extensions {
namespace {
RendererMessageFunction;
void UpdateTabSpecificPermissions(const ExtensionId& extension_id,
const extensions::URLPatternSet& new_hosts,
int tab_id,
bool update_origin_allowlist,
content::RenderProcessHost* process) { … }
void ClearTabSpecificPermissions(const std::vector<ExtensionId>& extension_ids,
int tab_id,
bool update_origin_allowlist,
content::RenderProcessHost* process) { … }
void SendRendererMessageToProcesses(
const std::set<content::RenderFrameHost*>& frame_hosts,
content::RenderProcessHost* tab_process,
const RendererMessageFunction& renderer_message) { … }
void SetCorsOriginAccessList(content::BrowserContext* browser_context,
const Extension& extension,
base::OnceClosure closure) { … }
}
ActiveTabPermissionGranter::ActiveTabPermissionGranter(
content::WebContents* web_contents,
int tab_id,
Profile* profile)
: … { … }
ActiveTabPermissionGranter::~ActiveTabPermissionGranter() { … }
void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { … }
void ActiveTabPermissionGranter::RevokeForTesting() { … }
void ActiveTabPermissionGranter::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { … }
void ActiveTabPermissionGranter::WebContentsDestroyed() { … }
void ActiveTabPermissionGranter::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
void ActiveTabPermissionGranter::ClearGrantedExtensionsAndNotify() { … }
void ActiveTabPermissionGranter::ClearActiveExtensionAndNotify(
const ExtensionId& id) { … }
void ActiveTabPermissionGranter::ClearGrantedExtensionsAndNotify(
const ExtensionSet& granted_extensions_to_remove) { … }
}