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 CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "chrome/browser/extensions/api/declarative_webrequest/request_stages.h" | 17 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" |
18 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" | 18 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" |
19 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" | 19 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
20 #include "chrome/browser/extensions/extension_function.h" | 20 #include "chrome/browser/extensions/extension_function.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/extensions/url_pattern_set.h" | 22 #include "chrome/common/extensions/url_pattern_set.h" |
23 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
24 #include "net/base/completion_callback.h" | 24 #include "net/base/completion_callback.h" |
25 #include "net/base/network_delegate.h" | 25 #include "net/base/network_delegate.h" |
26 #include "net/http/http_request_headers.h" | 26 #include "net/http/http_request_headers.h" |
27 #include "webkit/glue/resource_type.h" | 27 #include "webkit/glue/resource_type.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // Evaluates the rules of the declarative webrequest API and stores | 336 // Evaluates the rules of the declarative webrequest API and stores |
337 // modifications to the request that result from WebRequestActions as | 337 // modifications to the request that result from WebRequestActions as |
338 // deltas in |blocked_requests_|. |original_response_headers| should only be | 338 // deltas in |blocked_requests_|. |original_response_headers| should only be |
339 // set for the OnHeadersReceived stage and NULL otherwise. Returns whether any | 339 // set for the OnHeadersReceived stage and NULL otherwise. Returns whether any |
340 // deltas were generated. | 340 // deltas were generated. |
341 bool ProcessDeclarativeRules( | 341 bool ProcessDeclarativeRules( |
342 void* profile, | 342 void* profile, |
343 ExtensionInfoMap* extension_info_map, | 343 ExtensionInfoMap* extension_info_map, |
344 const std::string& event_name, | 344 const std::string& event_name, |
345 net::URLRequest* request, | 345 net::URLRequest* request, |
346 extensions::RequestStages request_stage, | 346 extensions::RequestStage request_stage, |
347 net::HttpResponseHeaders* original_response_headers); | 347 net::HttpResponseHeaders* original_response_headers); |
348 | 348 |
349 // Called when the RulesRegistry is ready to unblock a request that was | 349 // Called when the RulesRegistry is ready to unblock a request that was |
350 // waiting for said event. | 350 // waiting for said event. |
351 void OnRulesRegistryReady( | 351 void OnRulesRegistryReady( |
352 void* profile, | 352 void* profile, |
353 const std::string& event_name, | 353 const std::string& event_name, |
354 uint64 request_id, | 354 uint64 request_id, |
355 extensions::RequestStages request_stage); | 355 extensions::RequestStage request_stage); |
356 | 356 |
357 // Sets the flag that |event_type| has been signaled for |request_id|. | 357 // Sets the flag that |event_type| has been signaled for |request_id|. |
358 // Returns the value of the flag before setting it. | 358 // Returns the value of the flag before setting it. |
359 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); | 359 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); |
360 | 360 |
361 // Clears the flag that |event_type| has been signaled for |request_id|. | 361 // Clears the flag that |event_type| has been signaled for |request_id|. |
362 void ClearSignaled(uint64 request_id, EventTypes event_type); | 362 void ClearSignaled(uint64 request_id, EventTypes event_type); |
363 | 363 |
364 // Returns whether |request| represents a top level window navigation. | 364 // Returns whether |request| represents a top level window navigation. |
365 bool IsPageLoad(net::URLRequest* request) const; | 365 bool IsPageLoad(net::URLRequest* request) const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 virtual void OnQuotaExceeded() OVERRIDE; | 437 virtual void OnQuotaExceeded() OVERRIDE; |
438 virtual bool RunImpl() OVERRIDE; | 438 virtual bool RunImpl() OVERRIDE; |
439 }; | 439 }; |
440 | 440 |
441 // Send updates to |host| with information about what webRequest-related | 441 // Send updates to |host| with information about what webRequest-related |
442 // extensions are installed. | 442 // extensions are installed. |
443 // TODO(mpcomplete): remove. http://crbug.com/100411 | 443 // TODO(mpcomplete): remove. http://crbug.com/100411 |
444 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 444 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
445 | 445 |
446 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 446 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
OLD | NEW |