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

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: remove unneeded header files 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..a58d91ac10518b0722406966d3200f048fc5967d 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.h
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h
@@ -16,6 +16,7 @@
#include "components/ui/zoom/zoom_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/event_router.h"
+#include "extensions/common/value_builder.h"
namespace content {
class WebContents;
@@ -31,6 +32,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/16 18:11:56 Declare this above TabUpdated. Odd having a privat
not at google - send to devlin 2015/03/19 21:23:35 Not addressed?
+
public:
explicit TabsEventRouter(Profile* profile);
~TabsEventRouter() override;
@@ -82,7 +86,7 @@ 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, DictionaryBuilder* 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,19 +141,29 @@ class TabsEventRouter : public TabStripModelObserver,
// std::map<> by value.
TabEntry();
+ // Allow creating a TabEntry via a webcontents. Used when moving
+ // tabs between windows.
+ explicit TabEntry(content::WebContents* contents);
+
// 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 at google - send to devlin 2015/03/16 18:11:55 Comment needs to be rewritten, this doesn't return
// 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);
+ DictionaryBuilder* UpdateLoadState();
not at google - send to devlin 2015/03/16 18:11:55 Better to pass a scoped_ptr<DictionaryBuilder> her
// 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);
+ DictionaryBuilder* DidNavigate();
+
+ // Update the audible and muted states and return whether they were changed
+ bool SetAudible(bool new_val);
+ bool SetMuted(bool new_val);
+
+ // TODO(jaredsohn): make it private or add public accessor
not at google - send to devlin 2015/03/16 18:11:55 Please do this now - public web_contents() accesso
+ content::WebContents* contents_;
private:
// Whether we are waiting to fire the 'complete' status change. This will
@@ -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 was_audible_;
+ bool was_muted_;
+
GURL url_;
};

Powered by Google App Engine
This is Rietveld 408576698