Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(828)

Unified Diff: chrome/browser/extensions/api/tabs/tabs_event_router.h

Issue 987583004: Add audible, muted to Tab, c.t.query, c.t.update, and c.t.onUpdated where relevant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch1
Patch Set: attempt to add kalman as reviewer via git-cl owners (didn't work) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/tabs_event_router.h
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.h b/chrome/browser/extensions/api/tabs/tabs_event_router.h
index 73ee2c95945800530d26e0e89ebcf410b8c8dc4a..1a5eb3283dec203c18818b4ca9cab2761ba67efe 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.h
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h
@@ -84,6 +84,14 @@ class TabsEventRouter : public TabStripModelObserver,
// and Observe/NAV_ENTRY_COMMITTED.
void TabUpdated(content::WebContents* contents, bool did_navigate);
+ // Internal processing of tab audible and muted state change events.
+ // Called by TabUpdated.
+ void TabAudibleStateChanged(content::WebContents* contents,
+ bool audible);
+ void TabMutedStateChanged(content::WebContents* contents,
+ bool muted,
+ const std::string& cause);
+
// Triggers a tab updated event if the favicon URL changes.
void FaviconUrlUpdated(content::WebContents* contents);
@@ -129,6 +137,7 @@ class TabsEventRouter : public TabStripModelObserver,
// - distinguish between tab creation and tab insertion
// - not send tab-detached after tab-removed
// - reduce the "noise" of TabChangedAt() when sending events to extensions
+ // - remember last muted and audible states to know if there was a change
class TabEntry {
public:
// Create a new tab entry whose initial state is TAB_COMPLETE. This
@@ -150,6 +159,12 @@ class TabsEventRouter : public TabStripModelObserver,
// should be sent.
base::DictionaryValue* DidNavigate(const content::WebContents* contents);
+ // Keep track of previous audible and muted states and allow toggling them
+ bool AudibleChanged(bool val) const;
+ bool MutedChanged(bool val) const;
+ void ToggleAudible();
+ void ToggleMuted();
+
private:
// Whether we are waiting to fire the 'complete' status change. This will
// occur the first time the WebContents stops loading after the
@@ -157,6 +172,10 @@ class TabsEventRouter : public TabStripModelObserver,
// loading state subsequently, but we will ignore those changes.
bool complete_waiting_on_load_;
+ // Previous audible and muted states
+ bool wasAudible_;
miu 2015/03/10 18:51:39 style: No camel case for variables in Chromium C++
Jared Sohn 2015/03/16 02:34:29 Done.
+ bool wasMuted_;
+
GURL url_;
};

Powered by Google App Engine
This is Rietveld 408576698