| 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 EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H_ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H_ | 6 #define EXTENSIONS_BROWSER_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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 private: | 254 private: |
| 255 ~WebRequestRedirectToEmptyDocumentAction() override; | 255 ~WebRequestRedirectToEmptyDocumentAction() override; |
| 256 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToEmptyDocumentAction); | 256 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectToEmptyDocumentAction); |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 // Action that instructs to redirect a network request. | 259 // Action that instructs to redirect a network request. |
| 260 class WebRequestRedirectByRegExAction : public WebRequestAction { | 260 class WebRequestRedirectByRegExAction : public WebRequestAction { |
| 261 public: | 261 public: |
| 262 // The |to_pattern| has to be passed in RE2 syntax with the exception that | 262 // The |to_pattern| has to be passed in RE2 syntax with the exception that |
| 263 // capture groups are referenced in Perl style ($1, $2, ...). | 263 // capture groups are referenced in Perl style ($1, $2, ...). |
| 264 explicit WebRequestRedirectByRegExAction(scoped_ptr<re2::RE2> from_pattern, | 264 explicit WebRequestRedirectByRegExAction( |
| 265 const std::string& to_pattern); | 265 std::unique_ptr<re2::RE2> from_pattern, |
| 266 const std::string& to_pattern); |
| 266 | 267 |
| 267 // Conversion of capture group styles between Perl style ($1, $2, ...) and | 268 // Conversion of capture group styles between Perl style ($1, $2, ...) and |
| 268 // RE2 (\1, \2, ...). | 269 // RE2 (\1, \2, ...). |
| 269 static std::string PerlToRe2Style(const std::string& perl); | 270 static std::string PerlToRe2Style(const std::string& perl); |
| 270 | 271 |
| 271 // Implementation of WebRequestAction: | 272 // Implementation of WebRequestAction: |
| 272 bool Equals(const WebRequestAction* other) const override; | 273 bool Equals(const WebRequestAction* other) const override; |
| 273 std::string GetName() const override; | 274 std::string GetName() const override; |
| 274 LinkedPtrEventResponseDelta CreateDelta( | 275 LinkedPtrEventResponseDelta CreateDelta( |
| 275 const WebRequestData& request_data, | 276 const WebRequestData& request_data, |
| 276 const std::string& extension_id, | 277 const std::string& extension_id, |
| 277 const base::Time& extension_install_time) const override; | 278 const base::Time& extension_install_time) const override; |
| 278 | 279 |
| 279 private: | 280 private: |
| 280 ~WebRequestRedirectByRegExAction() override; | 281 ~WebRequestRedirectByRegExAction() override; |
| 281 | 282 |
| 282 scoped_ptr<re2::RE2> from_pattern_; | 283 std::unique_ptr<re2::RE2> from_pattern_; |
| 283 std::string to_pattern_; | 284 std::string to_pattern_; |
| 284 | 285 |
| 285 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectByRegExAction); | 286 DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectByRegExAction); |
| 286 }; | 287 }; |
| 287 | 288 |
| 288 // Action that instructs to set a request header. | 289 // Action that instructs to set a request header. |
| 289 class WebRequestSetRequestHeaderAction : public WebRequestAction { | 290 class WebRequestSetRequestHeaderAction : public WebRequestAction { |
| 290 public: | 291 public: |
| 291 WebRequestSetRequestHeaderAction(const std::string& name, | 292 WebRequestSetRequestHeaderAction(const std::string& name, |
| 292 const std::string& value); | 293 const std::string& value); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 private: | 463 private: |
| 463 ~WebRequestSendMessageToExtensionAction() override; | 464 ~WebRequestSendMessageToExtensionAction() override; |
| 464 | 465 |
| 465 std::string message_; | 466 std::string message_; |
| 466 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); | 467 DISALLOW_COPY_AND_ASSIGN(WebRequestSendMessageToExtensionAction); |
| 467 }; | 468 }; |
| 468 | 469 |
| 469 } // namespace extensions | 470 } // namespace extensions |
| 470 | 471 |
| 471 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H_ | 472 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_ACTION_H_ |
| OLD | NEW |