| 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> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class Time; | 25 class Time; |
| 26 class Value; | 26 class Value; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace extension_web_request_api_helpers { | 29 namespace extension_web_request_api_helpers { |
| 30 struct EventResponseDelta; | 30 struct EventResponseDelta; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace extensions { | 33 namespace extensions { |
| 34 class Extension; | 34 class Extension; |
| 35 struct DeclarativeWebRequestData; | 35 struct WebRequestData; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace net { | 38 namespace net { |
| 39 class URLRequest; | 39 class URLRequest; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace re2 { | 42 namespace re2 { |
| 43 class RE2; | 43 class RE2; |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 76 STRATEGY_ALLOW_SAME_DOMAIN, // Skip host permission checks if the request | 76 STRATEGY_ALLOW_SAME_DOMAIN, // Skip host permission checks if the request |
| 77 // URL and new URL have the same domain. | 77 // URL and new URL have the same domain. |
| 78 // Do these checks in DeltaHasPermission, | 78 // Do these checks in DeltaHasPermission, |
| 79 // after creating the delta. | 79 // after creating the delta. |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Information necessary to decide how to apply a WebRequestAction | 82 // Information necessary to decide how to apply a WebRequestAction |
| 83 // inside a matching rule. | 83 // inside a matching rule. |
| 84 struct ApplyInfo { | 84 struct ApplyInfo { |
| 85 const ExtensionInfoMap* extension_info_map; | 85 const ExtensionInfoMap* extension_info_map; |
| 86 const DeclarativeWebRequestData& request_data; | 86 const WebRequestData& request_data; |
| 87 bool crosses_incognito; | 87 bool crosses_incognito; |
| 88 // Modified by each applied action: | 88 // Modified by each applied action: |
| 89 std::list<LinkedPtrEventResponseDelta>* deltas; | 89 std::list<LinkedPtrEventResponseDelta>* deltas; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 WebRequestAction(); | 92 WebRequestAction(); |
| 93 virtual ~WebRequestAction(); | 93 virtual ~WebRequestAction(); |
| 94 | 94 |
| 95 // Returns a bit vector representing extensions::RequestStage. The bit vector | 95 // Returns a bit vector representing extensions::RequestStage. The bit vector |
| 96 // contains a 1 for each request stage during which the condition can be | 96 // contains a 1 for each request stage during which the condition can be |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Sets |error| and returns NULL in case of a semantic error that cannot | 140 // Sets |error| and returns NULL in case of a semantic error that cannot |
| 141 // be caught by schema validation. Sets |bad_message| and returns NULL | 141 // be caught by schema validation. Sets |bad_message| and returns NULL |
| 142 // in case the input is syntactically unexpected. | 142 // in case the input is syntactically unexpected. |
| 143 static scoped_ptr<WebRequestAction> Create(const base::Value& json_action, | 143 static scoped_ptr<WebRequestAction> Create(const base::Value& json_action, |
| 144 std::string* error, | 144 std::string* error, |
| 145 bool* bad_message); | 145 bool* bad_message); |
| 146 | 146 |
| 147 // Returns a description of the modification to the request caused by | 147 // Returns a description of the modification to the request caused by |
| 148 // this action. | 148 // this action. |
| 149 virtual LinkedPtrEventResponseDelta CreateDelta( | 149 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 150 const DeclarativeWebRequestData& request_data, | 150 const WebRequestData& request_data, |
| 151 const std::string& extension_id, | 151 const std::string& extension_id, |
| 152 const base::Time& extension_install_time) const = 0; | 152 const base::Time& extension_install_time) const = 0; |
| 153 | 153 |
| 154 // Applies this action to a request, recording the results into | 154 // Applies this action to a request, recording the results into |
| 155 // apply_info.deltas. | 155 // apply_info.deltas. |
| 156 void Apply(const std::string& extension_id, | 156 void Apply(const std::string& extension_id, |
| 157 base::Time extension_install_time, | 157 base::Time extension_install_time, |
| 158 ApplyInfo* apply_info) const; | 158 ApplyInfo* apply_info) const; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 typedef DeclarativeActionSet<WebRequestAction> WebRequestActionSet; | 161 typedef DeclarativeActionSet<WebRequestAction> WebRequestActionSet; |
| 162 | 162 |
| 163 // | 163 // |
| 164 // The following are concrete actions. | 164 // The following are concrete actions. |
| 165 // | 165 // |
| 166 | 166 |
| 167 // Action that instructs to cancel a network request. | 167 // Action that instructs to cancel a network request. |
| 168 class WebRequestCancelAction : public WebRequestAction { | 168 class WebRequestCancelAction : public WebRequestAction { |
| 169 public: | 169 public: |
| 170 WebRequestCancelAction(); | 170 WebRequestCancelAction(); |
| 171 virtual ~WebRequestCancelAction(); | 171 virtual ~WebRequestCancelAction(); |
| 172 | 172 |
| 173 // Implementation of WebRequestAction: | 173 // Implementation of WebRequestAction: |
| 174 virtual int GetStages() const OVERRIDE; | 174 virtual int GetStages() const OVERRIDE; |
| 175 virtual Type GetType() const OVERRIDE; | 175 virtual Type GetType() const OVERRIDE; |
| 176 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 176 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 177 virtual LinkedPtrEventResponseDelta CreateDelta( | 177 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 178 const DeclarativeWebRequestData& request_data, | 178 const WebRequestData& request_data, |
| 179 const std::string& extension_id, | 179 const std::string& extension_id, |
| 180 const base::Time& extension_install_time) const OVERRIDE; | 180 const base::Time& extension_install_time) const OVERRIDE; |
| 181 | 181 |
| 182 private: | 182 private: |
| 183 DISALLOW_COPY_AND_ASSIGN(WebRequestCancelAction); | 183 DISALLOW_COPY_AND_ASSIGN(WebRequestCancelAction); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 // Action that instructs to redirect a network request. | 186 // Action that instructs to redirect a network request. |
| 187 class WebRequestRedirectAction : public WebRequestAction { | 187 class WebRequestRedirectAction : public WebRequestAction { |
| 188 public: | 188 public: |
| 189 explicit WebRequestRedirectAction(const GURL& redirect_url); | 189 explicit WebRequestRedirectAction(const GURL& redirect_url); |
| 190 virtual ~WebRequestRedirectAction(); | 190 virtual ~WebRequestRedirectAction(); |
| 191 | 191 |
| 192 // Implementation of WebRequestAction: | 192 // Implementation of WebRequestAction: |
| 193 virtual int GetStages() const OVERRIDE; | 193 virtual int GetStages() const OVERRIDE; |
| 194 virtual Type GetType() const OVERRIDE; | 194 virtual Type GetType() const OVERRIDE; |
| 195 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 195 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 196 virtual LinkedPtrEventResponseDelta CreateDelta( | 196 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 197 const DeclarativeWebRequestData& request_data, | 197 const WebRequestData& request_data, |
| 198 const std::string& extension_id, | 198 const std::string& extension_id, |
| 199 const base::Time& extension_install_time) const OVERRIDE; | 199 const base::Time& extension_install_time) const OVERRIDE; |
| 200 | 200 |
| 201 private: | 201 private: |
| 202 GURL redirect_url_; // Target to which the request shall be redirected. | 202 GURL redirect_url_; // Target to which the request shall be redirected. |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectAction); | 204 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectAction); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 // Action that instructs to redirect a network request to a transparent image. | 207 // Action that instructs to redirect a network request to a transparent image. |
| 208 class WebRequestRedirectToTransparentImageAction : public WebRequestAction { | 208 class WebRequestRedirectToTransparentImageAction : public WebRequestAction { |
| 209 public: | 209 public: |
| 210 WebRequestRedirectToTransparentImageAction(); | 210 WebRequestRedirectToTransparentImageAction(); |
| 211 virtual ~WebRequestRedirectToTransparentImageAction(); | 211 virtual ~WebRequestRedirectToTransparentImageAction(); |
| 212 | 212 |
| 213 // Implementation of WebRequestAction: | 213 // Implementation of WebRequestAction: |
| 214 virtual int GetStages() const OVERRIDE; | 214 virtual int GetStages() const OVERRIDE; |
| 215 virtual Type GetType() const OVERRIDE; | 215 virtual Type GetType() const OVERRIDE; |
| 216 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 216 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 217 virtual LinkedPtrEventResponseDelta CreateDelta( | 217 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 218 const DeclarativeWebRequestData& request_data, | 218 const WebRequestData& request_data, |
| 219 const std::string& extension_id, | 219 const std::string& extension_id, |
| 220 const base::Time& extension_install_time) const OVERRIDE; | 220 const base::Time& extension_install_time) const OVERRIDE; |
| 221 | 221 |
| 222 private: | 222 private: |
| 223 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToTransparentImageAction); | 223 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToTransparentImageAction); |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 | 226 |
| 227 // Action that instructs to redirect a network request to an empty document. | 227 // Action that instructs to redirect a network request to an empty document. |
| 228 class WebRequestRedirectToEmptyDocumentAction : public WebRequestAction { | 228 class WebRequestRedirectToEmptyDocumentAction : public WebRequestAction { |
| 229 public: | 229 public: |
| 230 WebRequestRedirectToEmptyDocumentAction(); | 230 WebRequestRedirectToEmptyDocumentAction(); |
| 231 virtual ~WebRequestRedirectToEmptyDocumentAction(); | 231 virtual ~WebRequestRedirectToEmptyDocumentAction(); |
| 232 | 232 |
| 233 // Implementation of WebRequestAction: | 233 // Implementation of WebRequestAction: |
| 234 virtual int GetStages() const OVERRIDE; | 234 virtual int GetStages() const OVERRIDE; |
| 235 virtual Type GetType() const OVERRIDE; | 235 virtual Type GetType() const OVERRIDE; |
| 236 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 236 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 237 virtual LinkedPtrEventResponseDelta CreateDelta( | 237 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 238 const DeclarativeWebRequestData& request_data, | 238 const WebRequestData& request_data, |
| 239 const std::string& extension_id, | 239 const std::string& extension_id, |
| 240 const base::Time& extension_install_time) const OVERRIDE; | 240 const base::Time& extension_install_time) const OVERRIDE; |
| 241 | 241 |
| 242 private: | 242 private: |
| 243 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToEmptyDocumentAction); | 243 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToEmptyDocumentAction); |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 // Action that instructs to redirect a network request. | 246 // Action that instructs to redirect a network request. |
| 247 class WebRequestRedirectByRegExAction : public WebRequestAction { | 247 class WebRequestRedirectByRegExAction : public WebRequestAction { |
| 248 public: | 248 public: |
| 249 // The |to_pattern| has to be passed in RE2 syntax with the exception that | 249 // The |to_pattern| has to be passed in RE2 syntax with the exception that |
| 250 // capture groups are referenced in Perl style ($1, $2, ...). | 250 // capture groups are referenced in Perl style ($1, $2, ...). |
| 251 explicit WebRequestRedirectByRegExAction(scoped_ptr<re2::RE2> from_pattern, | 251 explicit WebRequestRedirectByRegExAction(scoped_ptr<re2::RE2> from_pattern, |
| 252 const std::string& to_pattern); | 252 const std::string& to_pattern); |
| 253 virtual ~WebRequestRedirectByRegExAction(); | 253 virtual ~WebRequestRedirectByRegExAction(); |
| 254 | 254 |
| 255 // Conversion of capture group styles between Perl style ($1, $2, ...) and | 255 // Conversion of capture group styles between Perl style ($1, $2, ...) and |
| 256 // RE2 (\1, \2, ...). | 256 // RE2 (\1, \2, ...). |
| 257 static std::string PerlToRe2Style(const std::string& perl); | 257 static std::string PerlToRe2Style(const std::string& perl); |
| 258 | 258 |
| 259 // Implementation of WebRequestAction: | 259 // Implementation of WebRequestAction: |
| 260 virtual int GetStages() const OVERRIDE; | 260 virtual int GetStages() const OVERRIDE; |
| 261 virtual Type GetType() const OVERRIDE; | 261 virtual Type GetType() const OVERRIDE; |
| 262 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 262 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 263 virtual LinkedPtrEventResponseDelta CreateDelta( | 263 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 264 const DeclarativeWebRequestData& request_data, | 264 const WebRequestData& request_data, |
| 265 const std::string& extension_id, | 265 const std::string& extension_id, |
| 266 const base::Time& extension_install_time) const OVERRIDE; | 266 const base::Time& extension_install_time) const OVERRIDE; |
| 267 | 267 |
| 268 private: | 268 private: |
| 269 scoped_ptr<re2::RE2> from_pattern_; | 269 scoped_ptr<re2::RE2> from_pattern_; |
| 270 std::string to_pattern_; | 270 std::string to_pattern_; |
| 271 | 271 |
| 272 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectByRegExAction); | 272 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectByRegExAction); |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 // Action that instructs to set a request header. | 275 // Action that instructs to set a request header. |
| 276 class WebRequestSetRequestHeaderAction : public WebRequestAction { | 276 class WebRequestSetRequestHeaderAction : public WebRequestAction { |
| 277 public: | 277 public: |
| 278 WebRequestSetRequestHeaderAction(const std::string& name, | 278 WebRequestSetRequestHeaderAction(const std::string& name, |
| 279 const std::string& value); | 279 const std::string& value); |
| 280 virtual ~WebRequestSetRequestHeaderAction(); | 280 virtual ~WebRequestSetRequestHeaderAction(); |
| 281 | 281 |
| 282 // Implementation of WebRequestAction: | 282 // Implementation of WebRequestAction: |
| 283 virtual int GetStages() const OVERRIDE; | 283 virtual int GetStages() const OVERRIDE; |
| 284 virtual Type GetType() const OVERRIDE; | 284 virtual Type GetType() const OVERRIDE; |
| 285 virtual LinkedPtrEventResponseDelta CreateDelta( | 285 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 286 const DeclarativeWebRequestData& request_data, | 286 const WebRequestData& request_data, |
| 287 const std::string& extension_id, | 287 const std::string& extension_id, |
| 288 const base::Time& extension_install_time) const OVERRIDE; | 288 const base::Time& extension_install_time) const OVERRIDE; |
| 289 | 289 |
| 290 private: | 290 private: |
| 291 std::string name_; | 291 std::string name_; |
| 292 std::string value_; | 292 std::string value_; |
| 293 DISALLOW_COPY_AND_ASSIGN(WebRequestSetRequestHeaderAction); | 293 DISALLOW_COPY_AND_ASSIGN(WebRequestSetRequestHeaderAction); |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 // Action that instructs to remove a request header. | 296 // Action that instructs to remove a request header. |
| 297 class WebRequestRemoveRequestHeaderAction : public WebRequestAction { | 297 class WebRequestRemoveRequestHeaderAction : public WebRequestAction { |
| 298 public: | 298 public: |
| 299 explicit WebRequestRemoveRequestHeaderAction(const std::string& name); | 299 explicit WebRequestRemoveRequestHeaderAction(const std::string& name); |
| 300 virtual ~WebRequestRemoveRequestHeaderAction(); | 300 virtual ~WebRequestRemoveRequestHeaderAction(); |
| 301 | 301 |
| 302 // Implementation of WebRequestAction: | 302 // Implementation of WebRequestAction: |
| 303 virtual int GetStages() const OVERRIDE; | 303 virtual int GetStages() const OVERRIDE; |
| 304 virtual Type GetType() const OVERRIDE; | 304 virtual Type GetType() const OVERRIDE; |
| 305 virtual LinkedPtrEventResponseDelta CreateDelta( | 305 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 306 const DeclarativeWebRequestData& request_data, | 306 const WebRequestData& request_data, |
| 307 const std::string& extension_id, | 307 const std::string& extension_id, |
| 308 const base::Time& extension_install_time) const OVERRIDE; | 308 const base::Time& extension_install_time) const OVERRIDE; |
| 309 | 309 |
| 310 private: | 310 private: |
| 311 std::string name_; | 311 std::string name_; |
| 312 DISALLOW_COPY_AND_ASSIGN(WebRequestRemoveRequestHeaderAction); | 312 DISALLOW_COPY_AND_ASSIGN(WebRequestRemoveRequestHeaderAction); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 // Action that instructs to add a response header. | 315 // Action that instructs to add a response header. |
| 316 class WebRequestAddResponseHeaderAction : public WebRequestAction { | 316 class WebRequestAddResponseHeaderAction : public WebRequestAction { |
| 317 public: | 317 public: |
| 318 WebRequestAddResponseHeaderAction(const std::string& name, | 318 WebRequestAddResponseHeaderAction(const std::string& name, |
| 319 const std::string& value); | 319 const std::string& value); |
| 320 virtual ~WebRequestAddResponseHeaderAction(); | 320 virtual ~WebRequestAddResponseHeaderAction(); |
| 321 | 321 |
| 322 // Implementation of WebRequestAction: | 322 // Implementation of WebRequestAction: |
| 323 virtual int GetStages() const OVERRIDE; | 323 virtual int GetStages() const OVERRIDE; |
| 324 virtual Type GetType() const OVERRIDE; | 324 virtual Type GetType() const OVERRIDE; |
| 325 virtual LinkedPtrEventResponseDelta CreateDelta( | 325 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 326 const DeclarativeWebRequestData& request_data, | 326 const WebRequestData& request_data, |
| 327 const std::string& extension_id, | 327 const std::string& extension_id, |
| 328 const base::Time& extension_install_time) const OVERRIDE; | 328 const base::Time& extension_install_time) const OVERRIDE; |
| 329 | 329 |
| 330 private: | 330 private: |
| 331 std::string name_; | 331 std::string name_; |
| 332 std::string value_; | 332 std::string value_; |
| 333 DISALLOW_COPY_AND_ASSIGN(WebRequestAddResponseHeaderAction); | 333 DISALLOW_COPY_AND_ASSIGN(WebRequestAddResponseHeaderAction); |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 // Action that instructs to remove a response header. | 336 // Action that instructs to remove a response header. |
| 337 class WebRequestRemoveResponseHeaderAction : public WebRequestAction { | 337 class WebRequestRemoveResponseHeaderAction : public WebRequestAction { |
| 338 public: | 338 public: |
| 339 explicit WebRequestRemoveResponseHeaderAction(const std::string& name, | 339 explicit WebRequestRemoveResponseHeaderAction(const std::string& name, |
| 340 const std::string& value, | 340 const std::string& value, |
| 341 bool has_value); | 341 bool has_value); |
| 342 virtual ~WebRequestRemoveResponseHeaderAction(); | 342 virtual ~WebRequestRemoveResponseHeaderAction(); |
| 343 | 343 |
| 344 // Implementation of WebRequestAction: | 344 // Implementation of WebRequestAction: |
| 345 virtual int GetStages() const OVERRIDE; | 345 virtual int GetStages() const OVERRIDE; |
| 346 virtual Type GetType() const OVERRIDE; | 346 virtual Type GetType() const OVERRIDE; |
| 347 virtual LinkedPtrEventResponseDelta CreateDelta( | 347 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 348 const DeclarativeWebRequestData& request_data, | 348 const WebRequestData& request_data, |
| 349 const std::string& extension_id, | 349 const std::string& extension_id, |
| 350 const base::Time& extension_install_time) const OVERRIDE; | 350 const base::Time& extension_install_time) const OVERRIDE; |
| 351 | 351 |
| 352 private: | 352 private: |
| 353 std::string name_; | 353 std::string name_; |
| 354 std::string value_; | 354 std::string value_; |
| 355 bool has_value_; | 355 bool has_value_; |
| 356 DISALLOW_COPY_AND_ASSIGN(WebRequestRemoveResponseHeaderAction); | 356 DISALLOW_COPY_AND_ASSIGN(WebRequestRemoveResponseHeaderAction); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 // Action that instructs to ignore rules below a certain priority. | 359 // Action that instructs to ignore rules below a certain priority. |
| 360 class WebRequestIgnoreRulesAction : public WebRequestAction { | 360 class WebRequestIgnoreRulesAction : public WebRequestAction { |
| 361 public: | 361 public: |
| 362 explicit WebRequestIgnoreRulesAction(int minimum_priority); | 362 explicit WebRequestIgnoreRulesAction(int minimum_priority); |
| 363 virtual ~WebRequestIgnoreRulesAction(); | 363 virtual ~WebRequestIgnoreRulesAction(); |
| 364 | 364 |
| 365 // Implementation of WebRequestAction: | 365 // Implementation of WebRequestAction: |
| 366 virtual int GetStages() const OVERRIDE; | 366 virtual int GetStages() const OVERRIDE; |
| 367 virtual Type GetType() const OVERRIDE; | 367 virtual Type GetType() const OVERRIDE; |
| 368 virtual int GetMinimumPriority() const OVERRIDE; | 368 virtual int GetMinimumPriority() const OVERRIDE; |
| 369 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; | 369 virtual HostPermissionsStrategy GetHostPermissionsStrategy() const OVERRIDE; |
| 370 virtual LinkedPtrEventResponseDelta CreateDelta( | 370 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 371 const DeclarativeWebRequestData& request_data, | 371 const WebRequestData& request_data, |
| 372 const std::string& extension_id, | 372 const std::string& extension_id, |
| 373 const base::Time& extension_install_time) const OVERRIDE; | 373 const base::Time& extension_install_time) const OVERRIDE; |
| 374 | 374 |
| 375 private: | 375 private: |
| 376 int minimum_priority_; | 376 int minimum_priority_; |
| 377 DISALLOW_COPY_AND_ASSIGN(WebRequestIgnoreRulesAction); | 377 DISALLOW_COPY_AND_ASSIGN(WebRequestIgnoreRulesAction); |
| 378 }; | 378 }; |
| 379 | 379 |
| 380 // Action that instructs to modify (add, edit, remove) a request cookie. | 380 // Action that instructs to modify (add, edit, remove) a request cookie. |
| 381 class WebRequestRequestCookieAction : public WebRequestAction { | 381 class WebRequestRequestCookieAction : public WebRequestAction { |
| 382 public: | 382 public: |
| 383 typedef extension_web_request_api_helpers::RequestCookieModification | 383 typedef extension_web_request_api_helpers::RequestCookieModification |
| 384 RequestCookieModification; | 384 RequestCookieModification; |
| 385 | 385 |
| 386 explicit WebRequestRequestCookieAction( | 386 explicit WebRequestRequestCookieAction( |
| 387 linked_ptr<RequestCookieModification> request_cookie_modification); | 387 linked_ptr<RequestCookieModification> request_cookie_modification); |
| 388 virtual ~WebRequestRequestCookieAction(); | 388 virtual ~WebRequestRequestCookieAction(); |
| 389 | 389 |
| 390 // Implementation of WebRequestAction: | 390 // Implementation of WebRequestAction: |
| 391 virtual int GetStages() const OVERRIDE; | 391 virtual int GetStages() const OVERRIDE; |
| 392 virtual Type GetType() const OVERRIDE; | 392 virtual Type GetType() const OVERRIDE; |
| 393 virtual LinkedPtrEventResponseDelta CreateDelta( | 393 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 394 const DeclarativeWebRequestData& request_data, | 394 const WebRequestData& request_data, |
| 395 const std::string& extension_id, | 395 const std::string& extension_id, |
| 396 const base::Time& extension_install_time) const OVERRIDE; | 396 const base::Time& extension_install_time) const OVERRIDE; |
| 397 | 397 |
| 398 private: | 398 private: |
| 399 linked_ptr<RequestCookieModification> request_cookie_modification_; | 399 linked_ptr<RequestCookieModification> request_cookie_modification_; |
| 400 DISALLOW_COPY_AND_ASSIGN(WebRequestRequestCookieAction); | 400 DISALLOW_COPY_AND_ASSIGN(WebRequestRequestCookieAction); |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 // Action that instructs to modify (add, edit, remove) a response cookie. | 403 // Action that instructs to modify (add, edit, remove) a response cookie. |
| 404 class WebRequestResponseCookieAction : public WebRequestAction { | 404 class WebRequestResponseCookieAction : public WebRequestAction { |
| 405 public: | 405 public: |
| 406 typedef extension_web_request_api_helpers::ResponseCookieModification | 406 typedef extension_web_request_api_helpers::ResponseCookieModification |
| 407 ResponseCookieModification; | 407 ResponseCookieModification; |
| 408 | 408 |
| 409 explicit WebRequestResponseCookieAction( | 409 explicit WebRequestResponseCookieAction( |
| 410 linked_ptr<ResponseCookieModification> response_cookie_modification); | 410 linked_ptr<ResponseCookieModification> response_cookie_modification); |
| 411 virtual ~WebRequestResponseCookieAction(); | 411 virtual ~WebRequestResponseCookieAction(); |
| 412 | 412 |
| 413 // Implementation of WebRequestAction: | 413 // Implementation of WebRequestAction: |
| 414 virtual int GetStages() const OVERRIDE; | 414 virtual int GetStages() const OVERRIDE; |
| 415 virtual Type GetType() const OVERRIDE; | 415 virtual Type GetType() const OVERRIDE; |
| 416 virtual LinkedPtrEventResponseDelta CreateDelta( | 416 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 417 const DeclarativeWebRequestData& request_data, | 417 const WebRequestData& request_data, |
| 418 const std::string& extension_id, | 418 const std::string& extension_id, |
| 419 const base::Time& extension_install_time) const OVERRIDE; | 419 const base::Time& extension_install_time) const OVERRIDE; |
| 420 | 420 |
| 421 private: | 421 private: |
| 422 linked_ptr<ResponseCookieModification> response_cookie_modification_; | 422 linked_ptr<ResponseCookieModification> response_cookie_modification_; |
| 423 DISALLOW_COPY_AND_ASSIGN(WebRequestResponseCookieAction); | 423 DISALLOW_COPY_AND_ASSIGN(WebRequestResponseCookieAction); |
| 424 }; | 424 }; |
| 425 | 425 |
| 426 // Action that triggers the chrome.declarativeWebRequest.onMessage event in | 426 // Action that triggers the chrome.declarativeWebRequest.onMessage event in |
| 427 // the background/event/... pages of the extension. | 427 // the background/event/... pages of the extension. |
| 428 class WebRequestSendMessageToExtensionAction : public WebRequestAction { | 428 class WebRequestSendMessageToExtensionAction : public WebRequestAction { |
| 429 public: | 429 public: |
| 430 explicit WebRequestSendMessageToExtensionAction(const std::string& message); | 430 explicit WebRequestSendMessageToExtensionAction(const std::string& message); |
| 431 virtual ~WebRequestSendMessageToExtensionAction(); | 431 virtual ~WebRequestSendMessageToExtensionAction(); |
| 432 | 432 |
| 433 // Implementation of WebRequestAction: | 433 // Implementation of WebRequestAction: |
| 434 virtual int GetStages() const OVERRIDE; | 434 virtual int GetStages() const OVERRIDE; |
| 435 virtual Type GetType() const OVERRIDE; | 435 virtual Type GetType() const OVERRIDE; |
| 436 virtual LinkedPtrEventResponseDelta CreateDelta( | 436 virtual LinkedPtrEventResponseDelta CreateDelta( |
| 437 const DeclarativeWebRequestData& request_data, | 437 const WebRequestData& request_data, |
| 438 const std::string& extension_id, | 438 const std::string& extension_id, |
| 439 const base::Time& extension_install_time) const OVERRIDE; | 439 const base::Time& extension_install_time) const OVERRIDE; |
| 440 | 440 |
| 441 private: | 441 private: |
| 442 std::string message_; | 442 std::string message_; |
| 443 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); | 443 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 } // namespace extensions | 446 } // namespace extensions |
| 447 | 447 |
| 448 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTIO
N_H_ | 448 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTIO
N_H_ |
| OLD | NEW |