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/common/chrome_version_info.h" | |
17 #include "chrome/browser/extensions/api/declarative_webrequest/request_stages.h" | 18 #include "chrome/browser/extensions/api/declarative_webrequest/request_stages.h" |
18 #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" |
19 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" | 20 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
20 #include "chrome/browser/extensions/extension_function.h" | 21 #include "chrome/browser/extensions/extension_function.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/extensions/url_pattern_set.h" | 23 #include "chrome/common/extensions/url_pattern_set.h" |
23 #include "ipc/ipc_sender.h" | 24 #include "ipc/ipc_sender.h" |
24 #include "net/base/completion_callback.h" | 25 #include "net/base/completion_callback.h" |
25 #include "net/base/network_delegate.h" | 26 #include "net/base/network_delegate.h" |
26 #include "net/http/http_request_headers.h" | 27 #include "net/http/http_request_headers.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 93 |
93 // Internal representation of the extraInfoSpec parameter on webRequest | 94 // Internal representation of the extraInfoSpec parameter on webRequest |
94 // events, used to specify extra information to be included with network | 95 // events, used to specify extra information to be included with network |
95 // events. | 96 // events. |
96 struct ExtraInfoSpec { | 97 struct ExtraInfoSpec { |
97 enum Flags { | 98 enum Flags { |
98 REQUEST_HEADERS = 1<<0, | 99 REQUEST_HEADERS = 1<<0, |
99 RESPONSE_HEADERS = 1<<1, | 100 RESPONSE_HEADERS = 1<<1, |
100 BLOCKING = 1<<2, | 101 BLOCKING = 1<<2, |
101 ASYNC_BLOCKING = 1<<3, | 102 ASYNC_BLOCKING = 1<<3, |
103 POST_DATA = 1<<4, | |
102 }; | 104 }; |
103 | 105 |
104 static bool InitFromValue(const base::ListValue& value, | 106 static bool InitFromValue(const base::ListValue& value, |
105 int* extra_info_spec); | 107 int* extra_info_spec); |
106 }; | 108 }; |
107 | 109 |
108 // Contains an extension's response to a blocking event. | 110 // Contains an extension's response to a blocking event. |
109 struct EventResponse { | 111 struct EventResponse { |
110 EventResponse(const std::string& extension_id, | 112 EventResponse(const std::string& extension_id, |
111 const base::Time& extension_install_time); | 113 const base::Time& extension_install_time); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 // function. | 438 // function. |
437 virtual void OnQuotaExceeded() OVERRIDE; | 439 virtual void OnQuotaExceeded() OVERRIDE; |
438 virtual bool RunImpl() OVERRIDE; | 440 virtual bool RunImpl() OVERRIDE; |
439 }; | 441 }; |
440 | 442 |
441 // Send updates to |host| with information about what webRequest-related | 443 // Send updates to |host| with information about what webRequest-related |
442 // extensions are installed. | 444 // extensions are installed. |
443 // TODO(mpcomplete): remove. http://crbug.com/100411 | 445 // TODO(mpcomplete): remove. http://crbug.com/100411 |
444 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 446 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
445 | 447 |
448 // Only to be used in tests. Allows to override the channel version, | |
449 // effectively making WebRequest believe that the current channel is |c|. | |
450 void SetChannelForTestingWebRequest(chrome::VersionInfo::Channel c); | |
Matt Perry
2012/08/02 10:11:03
nit: I'd put the WebRequest tag as a prefix, not a
vabr (Chromium)
2012/08/05 18:54:46
Done.
| |
451 | |
452 // Only to be used in tests. Resets the overriden channel info. | |
wtc
2012/08/03 00:57:19
Typo: overriden => overridden
vabr (Chromium)
2012/08/05 18:54:46
Done.
| |
453 void ResetChannelForTestingWebRequest(); | |
454 | |
446 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 455 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
OLD | NEW |