| 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/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" | 17 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
| 18 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" | 18 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" |
| 19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" | 19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" |
| 20 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" | 20 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
| 21 #include "content/public/common/resource_type.h" |
| 21 #include "extensions/browser/browser_context_keyed_api_factory.h" | 22 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 22 #include "extensions/browser/event_router.h" | 23 #include "extensions/browser/event_router.h" |
| 23 #include "extensions/browser/extension_function.h" | 24 #include "extensions/browser/extension_function.h" |
| 24 #include "extensions/common/url_pattern_set.h" | 25 #include "extensions/common/url_pattern_set.h" |
| 25 #include "ipc/ipc_sender.h" | 26 #include "ipc/ipc_sender.h" |
| 26 #include "net/base/completion_callback.h" | 27 #include "net/base/completion_callback.h" |
| 27 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
| 28 #include "net/http/http_request_headers.h" | 29 #include "net/http/http_request_headers.h" |
| 29 #include "webkit/common/resource_type.h" | |
| 30 | 30 |
| 31 class ExtensionWebRequestTimeTracker; | 31 class ExtensionWebRequestTimeTracker; |
| 32 class GURL; | 32 class GURL; |
| 33 | 33 |
| 34 namespace base { | 34 namespace base { |
| 35 class DictionaryValue; | 35 class DictionaryValue; |
| 36 class ListValue; | 36 class ListValue; |
| 37 class StringValue; | 37 class StringValue; |
| 38 } | 38 } |
| 39 | 39 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 struct RequestFilter { | 112 struct RequestFilter { |
| 113 RequestFilter(); | 113 RequestFilter(); |
| 114 ~RequestFilter(); | 114 ~RequestFilter(); |
| 115 | 115 |
| 116 // Returns false if there was an error initializing. If it is a user error, | 116 // Returns false if there was an error initializing. If it is a user error, |
| 117 // an error message is provided, otherwise the error is internal (and | 117 // an error message is provided, otherwise the error is internal (and |
| 118 // unexpected). | 118 // unexpected). |
| 119 bool InitFromValue(const base::DictionaryValue& value, std::string* error); | 119 bool InitFromValue(const base::DictionaryValue& value, std::string* error); |
| 120 | 120 |
| 121 extensions::URLPatternSet urls; | 121 extensions::URLPatternSet urls; |
| 122 std::vector<ResourceType::Type> types; | 122 std::vector<content::ResourceType::Type> types; |
| 123 int tab_id; | 123 int tab_id; |
| 124 int window_id; | 124 int window_id; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 // Internal representation of the extraInfoSpec parameter on webRequest | 127 // Internal representation of the extraInfoSpec parameter on webRequest |
| 128 // events, used to specify extra information to be included with network | 128 // events, used to specify extra information to be included with network |
| 129 // events. | 129 // events. |
| 130 struct ExtraInfoSpec { | 130 struct ExtraInfoSpec { |
| 131 enum Flags { | 131 enum Flags { |
| 132 REQUEST_HEADERS = 1<<0, | 132 REQUEST_HEADERS = 1<<0, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 void GetMatchingListenersImpl( | 350 void GetMatchingListenersImpl( |
| 351 void* profile, | 351 void* profile, |
| 352 extensions::InfoMap* extension_info_map, | 352 extensions::InfoMap* extension_info_map, |
| 353 bool crosses_incognito, | 353 bool crosses_incognito, |
| 354 const std::string& event_name, | 354 const std::string& event_name, |
| 355 const GURL& url, | 355 const GURL& url, |
| 356 int tab_id, | 356 int tab_id, |
| 357 int window_id, | 357 int window_id, |
| 358 int render_process_host_id, | 358 int render_process_host_id, |
| 359 int routing_id, | 359 int routing_id, |
| 360 ResourceType::Type resource_type, | 360 content::ResourceType::Type resource_type, |
| 361 bool is_async_request, | 361 bool is_async_request, |
| 362 bool is_request_from_extension, | 362 bool is_request_from_extension, |
| 363 int* extra_info_spec, | 363 int* extra_info_spec, |
| 364 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* | 364 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* |
| 365 matching_listeners); | 365 matching_listeners); |
| 366 | 366 |
| 367 // Decrements the count of event handlers blocking the given request. When the | 367 // Decrements the count of event handlers blocking the given request. When the |
| 368 // count reaches 0, we stop blocking the request and proceed it using the | 368 // count reaches 0, we stop blocking the request and proceed it using the |
| 369 // method requested by the extension with the highest precedence. Precedence | 369 // method requested by the extension with the highest precedence. Precedence |
| 370 // is decided by extension install time. If |response| is non-NULL, this | 370 // is decided by extension install time. If |response| is non-NULL, this |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // function. | 520 // function. |
| 521 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; | 521 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; |
| 522 virtual bool RunSync() OVERRIDE; | 522 virtual bool RunSync() OVERRIDE; |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 // Send updates to |host| with information about what webRequest-related | 525 // Send updates to |host| with information about what webRequest-related |
| 526 // extensions are installed. | 526 // extensions are installed. |
| 527 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 527 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
| 528 | 528 |
| 529 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 529 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| OLD | NEW |