#include "chrome/browser/extensions/api/tabs/tabs_event_router.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
#include "chrome/browser/extensions/api/tabs/windows_event_router.h"
#include "chrome/browser/extensions/browser_extension_window_controller.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/recently_audible_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/extension_constants.h"
#include "components/favicon/content/content_favicon_driver.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/common/mojom/event_dispatcher.mojom-forward.h"
#include "third_party/blink/public/common/page/page_zoom.h"
Value;
WebContents;
ZoomController;
namespace extensions {
namespace {
bool WillDispatchTabUpdatedEvent(
WebContents* contents,
const std::set<std::string> changed_property_names,
content::BrowserContext* browser_context,
mojom::ContextType target_context,
const Extension* extension,
const base::Value::Dict* listener_filter,
std::optional<base::Value::List>& event_args_out,
mojom::EventFilteringInfoPtr& event_filtering_info_out) { … }
bool WillDispatchTabCreatedEvent(
WebContents* contents,
bool active,
content::BrowserContext* browser_context,
mojom::ContextType target_context,
const Extension* extension,
const base::Value::Dict* listener_filter,
std::optional<base::Value::List>& event_args_out,
mojom::EventFilteringInfoPtr& event_filtering_info_out) { … }
}
TabsEventRouter::TabEntry::TabEntry(TabsEventRouter* router,
content::WebContents* contents)
: … { … }
std::set<std::string> TabsEventRouter::TabEntry::UpdateLoadState() { … }
bool TabsEventRouter::TabEntry::SetAudible(bool new_val) { … }
bool TabsEventRouter::TabEntry::SetMuted(bool new_val) { … }
void TabsEventRouter::TabEntry::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) { … }
void TabsEventRouter::TabEntry::TitleWasSet(content::NavigationEntry* entry) { … }
void TabsEventRouter::TabEntry::WebContentsDestroyed() { … }
TabsEventRouter::TabsEventRouter(Profile* profile)
: … { … }
TabsEventRouter::~TabsEventRouter() { … }
bool TabsEventRouter::ShouldTrackBrowser(Browser* browser) { … }
void TabsEventRouter::OnBrowserSetLastActive(Browser* browser) { … }
void TabsEventRouter::OnTabStripModelChanged(
TabStripModel* tab_strip_model,
const TabStripModelChange& change,
const TabStripSelectionChange& selection) { … }
void TabsEventRouter::TabChangedAt(WebContents* contents,
int index,
TabChangeType change_type) { … }
void TabsEventRouter::TabPinnedStateChanged(TabStripModel* tab_strip_model,
WebContents* contents,
int index) { … }
void TabsEventRouter::TabGroupedStateChanged(
std::optional<tab_groups::TabGroupId> group,
tabs::TabModel* tab,
int index) { … }
void TabsEventRouter::OnZoomControllerDestroyed(
zoom::ZoomController* zoom_controller) { … }
void TabsEventRouter::OnZoomChanged(
const ZoomController::ZoomChangedEventData& data) { … }
void TabsEventRouter::OnFaviconUpdated(
favicon::FaviconDriver* favicon_driver,
NotificationIconType notification_icon_type,
const GURL& icon_url,
bool icon_url_changed,
const gfx::Image& image) { … }
void TabsEventRouter::OnDiscardedStateChange(
WebContents* contents,
::mojom::LifecycleUnitDiscardReason reason,
bool is_discarded) { … }
void TabsEventRouter::OnAutoDiscardableStateChange(WebContents* contents,
bool is_auto_discardable) { … }
void TabsEventRouter::DispatchTabInsertedAt(TabStripModel* tab_strip_model,
WebContents* contents,
int index,
bool active) { … }
void TabsEventRouter::DispatchTabClosingAt(TabStripModel* tab_strip_model,
WebContents* contents,
int index) { … }
void TabsEventRouter::DispatchTabDetachedAt(WebContents* contents,
int index,
bool was_active) { … }
void TabsEventRouter::DispatchActiveTabChanged(WebContents* old_contents,
WebContents* new_contents) { … }
void TabsEventRouter::DispatchTabSelectionChanged(
TabStripModel* tab_strip_model,
const ui::ListSelectionModel& old_model) { … }
void TabsEventRouter::DispatchTabMoved(WebContents* contents,
int from_index,
int to_index) { … }
void TabsEventRouter::DispatchTabReplacedAt(WebContents* old_contents,
WebContents* new_contents,
int index) { … }
void TabsEventRouter::TabCreatedAt(WebContents* contents,
int index,
bool active) { … }
void TabsEventRouter::TabUpdated(TabEntry* entry,
std::set<std::string> changed_property_names) { … }
void TabsEventRouter::FaviconUrlUpdated(WebContents* contents) { … }
void TabsEventRouter::DispatchEvent(
Profile* profile,
events::HistogramValue histogram_value,
const std::string& event_name,
base::Value::List args,
EventRouter::UserGestureState user_gesture) { … }
void TabsEventRouter::DispatchTabUpdatedEvent(
WebContents* contents,
const std::set<std::string> changed_property_names) { … }
void TabsEventRouter::RegisterForTabNotifications(WebContents* contents) { … }
void TabsEventRouter::UnregisterForTabNotifications(WebContents* contents) { … }
TabsEventRouter::TabEntry* TabsEventRouter::GetTabEntry(WebContents* contents) { … }
}