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

Side by Side Diff: chrome/browser/extensions/extension_webrequest_api.h

Issue 6598002: Make the ChromeNetworkDelegate use the ExtensionEventRouterForwarder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSION_WEBREQUEST_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/singleton.h" 14 #include "base/singleton.h"
15 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.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 18
18 class ExtensionIOEventRouter; 19 class ExtensionEventRouterForwarder;
19 class GURL; 20 class GURL;
20 21
21 // This class observes network events and routes them to the appropriate 22 // This class observes network events and routes them to the appropriate
22 // extensions listening to those events. All methods must be called on the IO 23 // extensions listening to those events. All methods must be called on the IO
23 // thread unless otherwise specified. 24 // thread unless otherwise specified.
24 class ExtensionWebRequestEventRouter { 25 class ExtensionWebRequestEventRouter {
25 public: 26 public:
26 struct RequestFilter; 27 struct RequestFilter;
27 struct ExtraInfoSpec; 28 struct ExtraInfoSpec;
28 29
29 static ExtensionWebRequestEventRouter* GetInstance(); 30 static ExtensionWebRequestEventRouter* GetInstance();
30 31
31 // Removes the listener for the given sub-event. Can be called on the UI 32 // Removes the listener for the given sub-event. Can be called on the UI
32 // thread. 33 // thread.
33 static void RemoveEventListenerOnUIThread( 34 static void RemoveEventListenerOnUIThread(
34 const std::string& extension_id, 35 const std::string& extension_id,
35 const std::string& sub_event_name); 36 const std::string& sub_event_name);
36 37
37 // TODO(mpcomplete): additional params 38 // TODO(mpcomplete): additional params
38 void OnBeforeRequest( 39 void OnBeforeRequest(
39 const ExtensionIOEventRouter* event_router, 40 ExtensionEventRouterForwarder* event_router,
41 ProfileId profile_id,
40 const GURL& url, 42 const GURL& url,
41 const std::string& method); 43 const std::string& method);
42 44
43 // Adds a listener to the given event. |event_name| specifies the event being 45 // Adds a listener to the given event. |event_name| specifies the event being
44 // listened to. |sub_event_name| is an internal event uniquely generated in 46 // listened to. |sub_event_name| is an internal event uniquely generated in
45 // the extension process to correspond to the given filter and 47 // the extension process to correspond to the given filter and
46 // extra_info_spec. 48 // extra_info_spec.
47 void AddEventListener( 49 void AddEventListener(
48 const std::string& extension_id, 50 const std::string& extension_id,
49 const std::string& event_name, 51 const std::string& event_name,
(...skipping 26 matching lines...) Expand all
76 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); 78 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter);
77 }; 79 };
78 80
79 class WebRequestAddEventListener : public SyncExtensionFunction { 81 class WebRequestAddEventListener : public SyncExtensionFunction {
80 public: 82 public:
81 virtual bool RunImpl(); 83 virtual bool RunImpl();
82 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); 84 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener");
83 }; 85 };
84 86
85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ 87 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_proxy_api.cc ('k') | chrome/browser/extensions/extension_webrequest_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698