Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 class FilePath; | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 // Intercepts HTTP requests and gives pre-defined responses to specified URLs. | |
| 17 // The pre-defined responses are loaded from files on disk. The interception | |
| 18 // occurs while the URLRequestPrepackagedInterceptor is alive. | |
| 19 class URLRequestPrepackagedInterceptor { | |
| 20 public: | |
| 21 URLRequestPrepackagedInterceptor(); | |
| 22 virtual ~URLRequestPrepackagedInterceptor(); | |
| 23 | |
| 24 // When requests for |url| arrive, respond with the contents of |path|. The | |
| 25 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme | |
| 26 // must be "http". | |
| 27 void SetResponse(const std::string& url, | |
| 28 const FilePath& path); | |
| 29 | |
| 30 // Identical to SetResponse except that query parameters are ignored on | |
| 31 // incoming URLs when comparing against |url|. | |
| 32 void SetResponseIgnoreQuery(const std::string& url, | |
| 33 const FilePath& path); | |
|
mmenke
2012/12/11 17:22:38
nit: Could use a single line here and above.
| |
| 34 | |
| 35 // Returns how many requests have been issued that have a stored reply. | |
| 36 int GetHitCount(); | |
| 37 | |
| 38 private: | |
| 39 class Delegate; | |
| 40 | |
| 41 Delegate* delegate_; | |
|
mmenke
2012/12/11 17:22:38
Think it's worth mentioning that after creation, t
| |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor); | |
| 44 }; | |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | |
| OLD | NEW |