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..bf3e59548805a394b0796df9c2c403f1be4521a1 100644 |
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.h |
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h |
@@ -31,6 +31,9 @@ class TabsEventRouter : public TabStripModelObserver, |
public chrome::BrowserListObserver, |
public content::NotificationObserver, |
public ui_zoom::ZoomObserver { |
+ private: |
+ class TabEntry; |
not at google - send to devlin
2015/03/19 21:23:35
(as I mentioned: please move this to the private s
|
+ |
public: |
explicit TabsEventRouter(Profile* profile); |
~TabsEventRouter() override; |
@@ -82,7 +85,8 @@ class TabsEventRouter : public TabStripModelObserver, |
// Internal processing of tab updated events. Is called by both TabChangedAt |
// and Observe/NAV_ENTRY_COMMITTED. |
- void TabUpdated(content::WebContents* contents, bool did_navigate); |
+ void TabUpdated(TabEntry* entry, |
+ scoped_ptr<base::DictionaryValue> changed_properties); |
// Triggers a tab updated event if the favicon URL changes. |
void FaviconUrlUpdated(content::WebContents* contents); |
@@ -129,6 +133,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 |
@@ -136,27 +141,43 @@ class TabsEventRouter : public TabStripModelObserver, |
// std::map<> by value. |
TabEntry(); |
- // Update the load state of the tab based on its WebContents. Returns true |
- // if the state changed, false otherwise. Whether the state has changed or |
- // not is used to determine if events needs to be sent to extensions during |
- // processing of TabChangedAt(). This method will "hold" a state-change |
- // to "loading", until the DidNavigate() method which should always follow |
- // it. Returns NULL if no updates should be sent. |
- base::DictionaryValue* UpdateLoadState( |
- const content::WebContents* contents); |
+ // Allow creating a TabEntry via a webcontents. Used when moving |
+ // tabs between windows. |
+ explicit TabEntry(content::WebContents* contents); |
+ |
+ // Indicate via a list of key/value pairs if a tab is loading based on its |
+ // WebContents. Whether the state has changed or not is used to determine |
+ // if events needs to be sent to extensions during processing of |
+ // TabChangedAt(). If this method indicates that a tab should "hold" a |
+ // state-change to "loading", the DidNavigate() method should eventually |
+ // send a similar message to undo it. If false, the returned key/value |
+ // pairs list is empty. |
+ scoped_ptr<base::DictionaryValue> UpdateLoadState(); |
+ |
+ // Indicate via a list of key/value pairs that a tab load has resulted in a |
+ // navigation and the destination url is available for inspection. The list |
+ // is empty if no updates should be sent. |
+ scoped_ptr<base::DictionaryValue> DidNavigate(); |
- // Indicates that a tab load has resulted in a navigation and the |
- // destination url is available for inspection. Returns NULL if no updates |
- // should be sent. |
- base::DictionaryValue* DidNavigate(const content::WebContents* contents); |
+ // Update the audible and muted states and return whether they were changed |
+ bool SetAudible(bool new_val); |
+ bool SetMuted(bool new_val); |
+ |
+ content::WebContents* web_contents() { return contents_; } |
private: |
+ content::WebContents* contents_; |
+ |
// Whether we are waiting to fire the 'complete' status change. This will |
// occur the first time the WebContents stops loading after the |
// NAV_ENTRY_COMMITTED was fired. The tab may go back into and out of the |
// loading state subsequently, but we will ignore those changes. |
bool complete_waiting_on_load_; |
+ // Previous audible and muted states |
+ bool was_audible_; |
+ bool was_muted_; |
+ |
GURL url_; |
}; |