| 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_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H
_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H
_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H
_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H
_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "chrome/browser/extensions/api/declarative/declarative_rule.h" | 15 #include "chrome/browser/extensions/api/declarative/declarative_rule.h" |
| 16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" | 16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" |
| 17 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" | 17 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" |
| 18 #include "chrome/common/extensions/api/events.h" | 18 #include "chrome/common/extensions/api/events.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 class ExtensionInfoMap; | |
| 22 class WebRequestPermission; | 21 class WebRequestPermission; |
| 23 | 22 |
| 24 namespace base { | 23 namespace base { |
| 25 class DictionaryValue; | 24 class DictionaryValue; |
| 26 class Time; | 25 class Time; |
| 27 class Value; | 26 class Value; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace extension_web_request_api_helpers { | 29 namespace extension_web_request_api_helpers { |
| 31 struct EventResponseDelta; | 30 struct EventResponseDelta; |
| 32 } | 31 } |
| 33 | 32 |
| 34 namespace extensions { | 33 namespace extensions { |
| 35 class Extension; | 34 class Extension; |
| 35 class InfoMap; |
| 36 struct WebRequestData; | 36 struct WebRequestData; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace net { | 39 namespace net { |
| 40 class URLRequest; | 40 class URLRequest; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace re2 { | 43 namespace re2 { |
| 44 class RE2; | 44 class RE2; |
| 45 } | 45 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 76 STRATEGY_NONE, // Do not check host permissions. | 76 STRATEGY_NONE, // Do not check host permissions. |
| 77 STRATEGY_DEFAULT, // Check for host permissions for all URLs | 77 STRATEGY_DEFAULT, // Check for host permissions for all URLs |
| 78 // before creating the delta. | 78 // before creating the delta. |
| 79 STRATEGY_HOST, // Check that host permissions match the URL | 79 STRATEGY_HOST, // Check that host permissions match the URL |
| 80 // of the request. | 80 // of the request. |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Information necessary to decide how to apply a WebRequestAction | 83 // Information necessary to decide how to apply a WebRequestAction |
| 84 // inside a matching rule. | 84 // inside a matching rule. |
| 85 struct ApplyInfo { | 85 struct ApplyInfo { |
| 86 const ExtensionInfoMap* extension_info_map; | 86 const InfoMap* extension_info_map; |
| 87 const WebRequestData& request_data; | 87 const WebRequestData& request_data; |
| 88 bool crosses_incognito; | 88 bool crosses_incognito; |
| 89 // Modified by each applied action: | 89 // Modified by each applied action: |
| 90 std::list<LinkedPtrEventResponseDelta>* deltas; | 90 std::list<LinkedPtrEventResponseDelta>* deltas; |
| 91 std::set<std::string>* ignored_tags; | 91 std::set<std::string>* ignored_tags; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 int stages() const { | 94 int stages() const { |
| 95 return stages_; | 95 return stages_; |
| 96 } | 96 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 115 return host_permissions_strategy_; | 115 return host_permissions_strategy_; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Returns whether the specified extension has permission to execute this | 118 // Returns whether the specified extension has permission to execute this |
| 119 // action on |request|. Checks the host permission if the host permissions | 119 // action on |request|. Checks the host permission if the host permissions |
| 120 // strategy is STRATEGY_DEFAULT. | 120 // strategy is STRATEGY_DEFAULT. |
| 121 // |extension_info_map| may only be NULL for during testing, in which case | 121 // |extension_info_map| may only be NULL for during testing, in which case |
| 122 // host permissions are ignored. |crosses_incognito| specifies | 122 // host permissions are ignored. |crosses_incognito| specifies |
| 123 // whether the request comes from a different profile than |extension_id| | 123 // whether the request comes from a different profile than |extension_id| |
| 124 // but was processed because the extension is in spanning mode. | 124 // but was processed because the extension is in spanning mode. |
| 125 virtual bool HasPermission(const ExtensionInfoMap* extension_info_map, | 125 virtual bool HasPermission(const InfoMap* extension_info_map, |
| 126 const std::string& extension_id, | 126 const std::string& extension_id, |
| 127 const net::URLRequest* request, | 127 const net::URLRequest* request, |
| 128 bool crosses_incognito) const; | 128 bool crosses_incognito) const; |
| 129 | 129 |
| 130 // Factory method that instantiates a concrete WebRequestAction | 130 // Factory method that instantiates a concrete WebRequestAction |
| 131 // implementation according to |json_action|, the representation of the | 131 // implementation according to |json_action|, the representation of the |
| 132 // WebRequestAction as received from the extension API. | 132 // WebRequestAction as received from the extension API. |
| 133 // Sets |error| and returns NULL in case of a semantic error that cannot | 133 // Sets |error| and returns NULL in case of a semantic error that cannot |
| 134 // be caught by schema validation. Sets |bad_message| and returns NULL | 134 // be caught by schema validation. Sets |bad_message| and returns NULL |
| 135 // in case the input is syntactically unexpected. | 135 // in case the input is syntactically unexpected. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 private: | 460 private: |
| 461 virtual ~WebRequestSendMessageToExtensionAction(); | 461 virtual ~WebRequestSendMessageToExtensionAction(); |
| 462 | 462 |
| 463 std::string message_; | 463 std::string message_; |
| 464 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); | 464 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); |
| 465 }; | 465 }; |
| 466 | 466 |
| 467 } // namespace extensions | 467 } // namespace extensions |
| 468 | 468 |
| 469 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTIO
N_H_ | 469 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTIO
N_H_ |
| OLD | NEW |