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

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

Issue 1059743003: Remove NOTIFICATION_FAVICON_UPDATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-active-title
Patch Set: Add DISALLOW_COPY_AND_ASSIGN(FaviconUpdateWatcher) Created 5 years, 8 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 <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/scoped_observer.h"
13 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 14 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
14 #include "chrome/browser/ui/browser_list_observer.h" 15 #include "chrome/browser/ui/browser_list_observer.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
17 #include "components/favicon/core/favicon_driver_observer.h"
16 #include "components/ui/zoom/zoom_observer.h" 18 #include "components/ui/zoom/zoom_observer.h"
17 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
18 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
19 21
22 class FaviconTabHelper;
23
20 namespace content { 24 namespace content {
21 class WebContents; 25 class WebContents;
22 } 26 }
23 27
24 namespace extensions { 28 namespace extensions {
25 29
26 // The TabsEventRouter listens to tab events and routes them to listeners inside 30 // The TabsEventRouter listens to tab events and routes them to listeners inside
27 // extension process renderers. 31 // extension process renderers.
28 // TabsEventRouter will only route events from windows/tabs within a profile to 32 // TabsEventRouter will only route events from windows/tabs within a profile to
29 // extension processes in the same profile. 33 // extension processes in the same profile.
30 class TabsEventRouter : public TabStripModelObserver, 34 class TabsEventRouter : public TabStripModelObserver,
31 public chrome::BrowserListObserver, 35 public chrome::BrowserListObserver,
32 public content::NotificationObserver, 36 public content::NotificationObserver,
37 public favicon::FaviconDriverObserver,
33 public ui_zoom::ZoomObserver { 38 public ui_zoom::ZoomObserver {
34 public: 39 public:
35 explicit TabsEventRouter(Profile* profile); 40 explicit TabsEventRouter(Profile* profile);
36 ~TabsEventRouter() override; 41 ~TabsEventRouter() override;
37 42
38 // chrome::BrowserListObserver 43 // chrome::BrowserListObserver
39 void OnBrowserAdded(Browser* browser) override; 44 void OnBrowserAdded(Browser* browser) override;
40 void OnBrowserRemoved(Browser* browser) override; 45 void OnBrowserRemoved(Browser* browser) override;
41 void OnBrowserSetLastActive(Browser* browser) override; 46 void OnBrowserSetLastActive(Browser* browser) override;
42 47
(...skipping 26 matching lines...) Expand all
69 74
70 // content::NotificationObserver. 75 // content::NotificationObserver.
71 void Observe(int type, 76 void Observe(int type,
72 const content::NotificationSource& source, 77 const content::NotificationSource& source,
73 const content::NotificationDetails& details) override; 78 const content::NotificationDetails& details) override;
74 79
75 // ZoomObserver. 80 // ZoomObserver.
76 void OnZoomChanged( 81 void OnZoomChanged(
77 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; 82 const ui_zoom::ZoomController::ZoomChangedEventData& data) override;
78 83
84 // favicon::FaviconDriverObserver.
85 void OnFaviconAvailable(const gfx::Image& image) override;
86 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
87 bool icon_url_changed) override;
88
79 private: 89 private:
80 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. 90 // "Synthetic" event. Called from TabInsertedAt if new tab is detected.
81 void TabCreatedAt(content::WebContents* contents, int index, bool active); 91 void TabCreatedAt(content::WebContents* contents, int index, bool active);
82 92
83 // Internal processing of tab updated events. Is called by both TabChangedAt 93 // Internal processing of tab updated events. Is called by both TabChangedAt
84 // and Observe/NAV_ENTRY_COMMITTED. 94 // and Observe/NAV_ENTRY_COMMITTED.
85 void TabUpdated(content::WebContents* contents, bool did_navigate); 95 void TabUpdated(content::WebContents* contents, bool did_navigate);
86 96
87 // Triggers a tab updated event if the favicon URL changes. 97 // Triggers a tab updated event if the favicon URL changes.
88 void FaviconUrlUpdated(content::WebContents* contents); 98 void FaviconUrlUpdated(content::WebContents* contents);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 172
163 // Gets the TabEntry for the given |contents|. Returns TabEntry* if 173 // Gets the TabEntry for the given |contents|. Returns TabEntry* if
164 // found, NULL if not. 174 // found, NULL if not.
165 TabEntry* GetTabEntry(content::WebContents* contents); 175 TabEntry* GetTabEntry(content::WebContents* contents);
166 176
167 std::map<int, TabEntry> tab_entries_; 177 std::map<int, TabEntry> tab_entries_;
168 178
169 // The main profile that owns this event router. 179 // The main profile that owns this event router.
170 Profile* profile_; 180 Profile* profile_;
171 181
182 ScopedObserver<FaviconTabHelper, TabsEventRouter> favicon_scoped_observer_;
183
172 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); 184 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter);
173 }; 185 };
174 186
175 } // namespace extensions 187 } // namespace extensions
176 188
177 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ 189 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('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