OLD | NEW |
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 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 namespace net { | 46 namespace net { |
47 class AuthChallengeInfo; | 47 class AuthChallengeInfo; |
48 class AuthCredentials; | 48 class AuthCredentials; |
49 class HttpRequestHeaders; | 49 class HttpRequestHeaders; |
50 class HttpResponseHeaders; | 50 class HttpResponseHeaders; |
51 class URLRequest; | 51 class URLRequest; |
52 } | 52 } |
53 | 53 |
54 namespace extensions { | 54 namespace extensions { |
55 | 55 |
| 56 struct ExtensionApiFrameId; |
56 class InfoMap; | 57 class InfoMap; |
57 class WebRequestRulesRegistry; | 58 class WebRequestRulesRegistry; |
58 class WebRequestEventRouterDelegate; | 59 class WebRequestEventRouterDelegate; |
59 | 60 |
60 // Support class for the WebRequest API. Lives on the UI thread. Most of the | 61 // Support class for the WebRequest API. Lives on the UI thread. Most of the |
61 // work is done by ExtensionWebRequestEventRouter below. This class observes | 62 // work is done by ExtensionWebRequestEventRouter below. This class observes |
62 // extensions::EventRouter to deal with event listeners. There is one instance | 63 // extensions::EventRouter to deal with event listeners. There is one instance |
63 // per BrowserContext which is shared with incognito. | 64 // per BrowserContext which is shared with incognito. |
64 class WebRequestAPI : public BrowserContextKeyedAPI, | 65 class WebRequestAPI : public BrowserContextKeyedAPI, |
65 public EventRouter::Observer { | 66 public EventRouter::Observer { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // Ensures that future callbacks for |request| are ignored so that it can be | 333 // Ensures that future callbacks for |request| are ignored so that it can be |
333 // destroyed safely. | 334 // destroyed safely. |
334 void ClearPendingCallbacks(const net::URLRequest* request); | 335 void ClearPendingCallbacks(const net::URLRequest* request); |
335 | 336 |
336 bool DispatchEvent( | 337 bool DispatchEvent( |
337 void* browser_context, | 338 void* browser_context, |
338 net::URLRequest* request, | 339 net::URLRequest* request, |
339 const std::vector<const EventListener*>& listeners, | 340 const std::vector<const EventListener*>& listeners, |
340 const base::ListValue& args); | 341 const base::ListValue& args); |
341 | 342 |
| 343 void DispatchEventToListeners( |
| 344 void* browser_context, |
| 345 scoped_ptr<std::vector<EventListener>> listeners, |
| 346 base::DictionaryValue* dict, |
| 347 const ExtensionApiFrameId& extension_api_frame_id); |
| 348 |
342 // Returns a list of event listeners that care about the given event, based | 349 // Returns a list of event listeners that care about the given event, based |
343 // on their filter parameters. |extra_info_spec| will contain the combined | 350 // on their filter parameters. |extra_info_spec| will contain the combined |
344 // set of extra_info_spec flags that every matching listener asked for. | 351 // set of extra_info_spec flags that every matching listener asked for. |
345 std::vector<const EventListener*> GetMatchingListeners( | 352 std::vector<const EventListener*> GetMatchingListeners( |
346 void* browser_context, | 353 void* browser_context, |
347 const extensions::InfoMap* extension_info_map, | 354 const extensions::InfoMap* extension_info_map, |
348 const std::string& event_name, | 355 const std::string& event_name, |
349 const net::URLRequest* request, | 356 const net::URLRequest* request, |
350 int* extra_info_spec); | 357 int* extra_info_spec); |
351 | 358 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 extensions::QuotaLimitHeuristics* heuristics) const override; | 559 extensions::QuotaLimitHeuristics* heuristics) const override; |
553 // Handle quota exceeded gracefully: Only warn the user but still execute the | 560 // Handle quota exceeded gracefully: Only warn the user but still execute the |
554 // function. | 561 // function. |
555 void OnQuotaExceeded(const std::string& error) override; | 562 void OnQuotaExceeded(const std::string& error) override; |
556 bool RunSync() override; | 563 bool RunSync() override; |
557 }; | 564 }; |
558 | 565 |
559 } // namespace extensions | 566 } // namespace extensions |
560 | 567 |
561 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 568 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
OLD | NEW |