| OLD | NEW |
| (Empty) | |
| 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 |
| 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 "base/basictypes.h" |
| 9 |
| 10 class FilePath; |
| 11 class GURL; |
| 12 |
| 13 namespace content { |
| 14 |
| 15 // Intercepts HTTP requests and gives pre-defined responses to specified URLs. |
| 16 // The pre-defined responses are loaded from files on disk. The interception |
| 17 // occurs while the URLRequestPrepackagedInterceptor is alive. |
| 18 class URLRequestPrepackagedInterceptor { |
| 19 public: |
| 20 URLRequestPrepackagedInterceptor(); |
| 21 virtual ~URLRequestPrepackagedInterceptor(); |
| 22 |
| 23 // When requests for |url| arrive, respond with the contents of |path|. The |
| 24 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme |
| 25 // must be "http". |
| 26 void SetResponse(const GURL& url, const FilePath& path); |
| 27 |
| 28 // Identical to SetResponse except that query parameters are ignored on |
| 29 // incoming URLs when comparing against |url|. |
| 30 void SetResponseIgnoreQuery(const GURL& url, const FilePath& path); |
| 31 |
| 32 // Returns how many requests have been issued that have a stored reply. |
| 33 int GetHitCount(); |
| 34 |
| 35 private: |
| 36 class Delegate; |
| 37 |
| 38 // After creation, |delegate_| lives on the IO thread, and a task to delete |
| 39 // it is posted from ~URLRequestPrepackagedInterceptor(). |
| 40 Delegate* delegate_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(URLRequestPrepackagedInterceptor); |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |
| OLD | NEW |