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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_event_router.h

Issue 2142413003: Adding Discarded property support for onUpdate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@API_Discarded
Patch Set: nit fixed Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
14 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 14 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
15 #include "chrome/browser/memory/tab_manager.h"
16 #include "chrome/browser/memory/tab_manager_observer.h"
15 #include "chrome/browser/ui/browser_list_observer.h" 17 #include "chrome/browser/ui/browser_list_observer.h"
16 #include "chrome/browser/ui/browser_tab_strip_tracker.h" 18 #include "chrome/browser/ui/browser_tab_strip_tracker.h"
17 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" 19 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
19 #include "components/favicon/core/favicon_driver_observer.h" 21 #include "components/favicon/core/favicon_driver_observer.h"
20 #include "components/zoom/zoom_observer.h" 22 #include "components/zoom/zoom_observer.h"
21 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
22 #include "extensions/browser/event_router.h" 24 #include "extensions/browser/event_router.h"
23 25
24 namespace content { 26 namespace content {
25 class WebContents; 27 class WebContents;
26 } 28 }
27 29
28 namespace favicon { 30 namespace favicon {
29 class FaviconDriver; 31 class FaviconDriver;
30 } 32 }
31 33
32 namespace extensions { 34 namespace extensions {
33 35
34 // The TabsEventRouter listens to tab events and routes them to listeners inside 36 // The TabsEventRouter listens to tab events and routes them to listeners inside
35 // extension process renderers. 37 // extension process renderers.
36 // TabsEventRouter will only route events from windows/tabs within a profile to 38 // TabsEventRouter will only route events from windows/tabs within a profile to
37 // extension processes in the same profile. 39 // extension processes in the same profile.
38 class TabsEventRouter : public TabStripModelObserver, 40 class TabsEventRouter : public TabStripModelObserver,
39 public BrowserTabStripTrackerDelegate, 41 public BrowserTabStripTrackerDelegate,
40 public chrome::BrowserListObserver, 42 public chrome::BrowserListObserver,
41 public favicon::FaviconDriverObserver, 43 public favicon::FaviconDriverObserver,
42 public zoom::ZoomObserver { 44 public zoom::ZoomObserver,
45 public memory::TabManagerObserver {
43 public: 46 public:
44 explicit TabsEventRouter(Profile* profile); 47 explicit TabsEventRouter(Profile* profile);
45 ~TabsEventRouter() override; 48 ~TabsEventRouter() override;
46 49
47 // BrowserTabStripTrackerDelegate: 50 // BrowserTabStripTrackerDelegate:
48 bool ShouldTrackBrowser(Browser* browser) override; 51 bool ShouldTrackBrowser(Browser* browser) override;
49 52
50 // chrome::BrowserListObserver: 53 // chrome::BrowserListObserver:
51 void OnBrowserSetLastActive(Browser* browser) override; 54 void OnBrowserSetLastActive(Browser* browser) override;
52 55
(...skipping 28 matching lines...) Expand all
81 void OnZoomChanged( 84 void OnZoomChanged(
82 const zoom::ZoomController::ZoomChangedEventData& data) override; 85 const zoom::ZoomController::ZoomChangedEventData& data) override;
83 86
84 // favicon::FaviconDriverObserver: 87 // favicon::FaviconDriverObserver:
85 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, 88 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
86 NotificationIconType notification_icon_type, 89 NotificationIconType notification_icon_type,
87 const GURL& icon_url, 90 const GURL& icon_url,
88 bool icon_url_changed, 91 bool icon_url_changed,
89 const gfx::Image& image) override; 92 const gfx::Image& image) override;
90 93
94 // memory::TabManagerObserver:
95 void OnDiscardedStateChange(content::WebContents* contents,
96 bool is_discarded) override;
97
91 private: 98 private:
92 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. 99 // "Synthetic" event. Called from TabInsertedAt if new tab is detected.
93 void TabCreatedAt(content::WebContents* contents, int index, bool active); 100 void TabCreatedAt(content::WebContents* contents, int index, bool active);
94 101
95 // Internal processing of tab updated events. Intended to be called when 102 // Internal processing of tab updated events. Intended to be called when
96 // there's any changed property. 103 // there's any changed property.
97 class TabEntry; 104 class TabEntry;
98 void TabUpdated(TabEntry* entry, 105 void TabUpdated(TabEntry* entry,
99 std::set<std::string> changed_property_names); 106 std::set<std::string> changed_property_names);
100 107
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 TabEntryMap tab_entries_; 196 TabEntryMap tab_entries_;
190 197
191 // The main profile that owns this event router. 198 // The main profile that owns this event router.
192 Profile* profile_; 199 Profile* profile_;
193 200
194 ScopedObserver<favicon::FaviconDriver, TabsEventRouter> 201 ScopedObserver<favicon::FaviconDriver, TabsEventRouter>
195 favicon_scoped_observer_; 202 favicon_scoped_observer_;
196 203
197 BrowserTabStripTracker browser_tab_strip_tracker_; 204 BrowserTabStripTracker browser_tab_strip_tracker_;
198 205
206 ScopedObserver<memory::TabManager, TabsEventRouter>
207 tab_manager_scoped_observer_;
208
199 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); 209 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter);
200 }; 210 };
201 211
202 } // namespace extensions 212 } // namespace extensions
203 213
204 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ 214 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_constants.cc ('k') | chrome/browser/extensions/api/tabs/tabs_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698