From 1f071893d22e2260b5ebc6c97a02626a9ca945fe Mon Sep 17 00:00:00 2001 From: limasdf Date: Tue, 9 Feb 2016 02:18:00 -0800 Subject: Get change property value when tabs.onUpdated is fired. When chrome.tabs.onupdated is fired, we get tab values for second parameter (which privacy sensitive values are already scrubed). That means we can just get changed value from it. So just pass changed property name(std::set<>) only instead of property key-value(base::DictionaryValue). BUG=582484 TEST=browser_tests --gtest_filter=ExtensionApiTest.* Review URL: https://codereview.chromium.org/1639253009 Cr-Commit-Position: refs/heads/master@{#374345} --- .../extensions/api/tabs/tabs_event_router.h | 32 ++++++++-------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to '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 c78463d..0c512ae 100644 --- a/chrome/browser/extensions/api/tabs/tabs_event_router.h +++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ #include +#include #include #include "base/macros.h" @@ -95,7 +96,7 @@ class TabsEventRouter : public TabStripModelObserver, // there's any changed property. class TabEntry; void TabUpdated(TabEntry* entry, - scoped_ptr changed_properties); + std::set changed_property_names); // Triggers a tab updated event if the favicon URL changes. void FaviconUrlUpdated(content::WebContents* contents); @@ -115,11 +116,11 @@ class TabsEventRouter : public TabStripModelObserver, scoped_ptr event_args, scoped_ptr cross_incognito_args); - // Packages |changed_properties| as a tab updated event for the tab |contents| - // and dispatches the event to the extension. + // Packages |changed_property_names| as a tab updated event for the tab + // |contents| and dispatches the event to the extension. void DispatchTabUpdatedEvent( content::WebContents* contents, - scoped_ptr changed_properties); + const std::set changed_property_names); // Register ourselves to receive the various notifications we are interested // in for a tab. Also create tab entry to observe web contents notifications. @@ -142,22 +143,13 @@ class TabsEventRouter : public TabStripModelObserver, // |contents|. TabEntry(TabsEventRouter* router, 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 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 DidNavigate(); - - // Indicate via a list of key/value pairs if the title of a tab is changed. - scoped_ptr TitleChanged(); + // Indicate via a list of property names if a tab is loading based on its + // WebContents. Whether the state has changed or not is used to determine if + // events need to be sent to extensions during processing of TabChangedAt() + // If this method indicates that a tab should "hold" a state-change to + // "loading", the NavigationEntryCommitted() method should eventually send a + // similar message to undo it. + std::set UpdateLoadState(); // Update the audible and muted states and return whether they were changed bool SetAudible(bool new_val); -- cgit v1.1