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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.h

Issue 10690151: Move implementation of BrowserList onto an inner, instantiatable class, BrowserListImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines the Chrome Extensions WebNavigation API functions for observing and 5 // Defines the Chrome Extensions WebNavigation API functions for observing and
6 // intercepting navigation events, as specified in the extension JSON API. 6 // intercepting navigation events, as specified in the extension JSON API.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
10 #pragma once 10 #pragma once
11 11
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list_observer.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/web_contents_observer.h" 22 #include "content/public/browser/web_contents_observer.h"
23 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
24 24
25 struct RetargetingDetails; 25 struct RetargetingDetails;
26 26
27 namespace extensions { 27 namespace extensions {
28 28
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Used for tracking registrations to redirect notifications. 190 // Used for tracking registrations to redirect notifications.
191 content::NotificationRegistrar registrar_; 191 content::NotificationRegistrar registrar_;
192 192
193 DISALLOW_COPY_AND_ASSIGN(WebNavigationTabObserver); 193 DISALLOW_COPY_AND_ASSIGN(WebNavigationTabObserver);
194 }; 194 };
195 195
196 // Observes navigation notifications and routes them as events to the extension 196 // Observes navigation notifications and routes them as events to the extension
197 // system. 197 // system.
198 class WebNavigationEventRouter : public TabStripModelObserver, 198 class WebNavigationEventRouter : public TabStripModelObserver,
199 public BrowserList::Observer, 199 public chrome::BrowserListObserver,
200 public content::NotificationObserver { 200 public content::NotificationObserver {
201 public: 201 public:
202 explicit WebNavigationEventRouter(Profile* profile); 202 explicit WebNavigationEventRouter(Profile* profile);
203 virtual ~WebNavigationEventRouter(); 203 virtual ~WebNavigationEventRouter();
204 204
205 // Invoked by the extensions service once the extension system is fully set 205 // Invoked by the extensions service once the extension system is fully set
206 // up and can start dispatching events to extensions. 206 // up and can start dispatching events to extensions.
207 void Init(); 207 void Init();
208 208
209 private: 209 private:
(...skipping 13 matching lines...) Expand all
223 content::WebContents* target_web_contents; 223 content::WebContents* target_web_contents;
224 GURL target_url; 224 GURL target_url;
225 }; 225 };
226 226
227 // TabStripModelObserver implementation. 227 // TabStripModelObserver implementation.
228 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 228 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
229 TabContents* old_contents, 229 TabContents* old_contents,
230 TabContents* new_contents, 230 TabContents* new_contents,
231 int index) OVERRIDE; 231 int index) OVERRIDE;
232 232
233 // BrowserList::Observer implementation. 233 // chrome::BrowserListObserver implementation.
234 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; 234 virtual void OnBrowserAdded(Browser* browser) OVERRIDE;
235 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; 235 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
236 236
237 // content::NotificationObserver implementation. 237 // content::NotificationObserver implementation.
238 virtual void Observe(int type, 238 virtual void Observe(int type,
239 const content::NotificationSource& source, 239 const content::NotificationSource& source,
240 const content::NotificationDetails& details) OVERRIDE; 240 const content::NotificationDetails& details) OVERRIDE;
241 241
242 // Handler for the NOTIFICATION_RETARGETING event. The method takes the 242 // Handler for the NOTIFICATION_RETARGETING event. The method takes the
243 // details of such an event and stores them for the later 243 // details of such an event and stores them for the later
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // API function that returns the states of all frames in a given tab. 275 // API function that returns the states of all frames in a given tab.
276 class GetAllFramesFunction : public SyncExtensionFunction { 276 class GetAllFramesFunction : public SyncExtensionFunction {
277 virtual ~GetAllFramesFunction() {} 277 virtual ~GetAllFramesFunction() {}
278 virtual bool RunImpl() OVERRIDE; 278 virtual bool RunImpl() OVERRIDE;
279 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames") 279 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames")
280 }; 280 };
281 281
282 } // namespace extensions 282 } // namespace extensions
283 283
284 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 284 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698