Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/component_updater/component_updater_interceptor.h

Issue 7601019: Component updater eight piece (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_interceptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 ComponentUpdateInterceptor(); 27 ComponentUpdateInterceptor();
28 28
29 // When requests for |url| arrive, respond with the contents of |path|. The 29 // When requests for |url| arrive, respond with the contents of |path|. The
30 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme 30 // hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
31 // must be "http". 31 // must be "http".
32 void SetResponse(const std::string& url, 32 void SetResponse(const std::string& url,
33 const std::string& headers, 33 const std::string& headers,
34 const FilePath& path); 34 const FilePath& path);
35 35
36 // Returns how many requests have been issued that have a stored reply.
37 int hit_count() const { return hit_count_; }
38
36 private: 39 private:
37 // When computing matches, this ignores the query parameters of the url. 40 // When computing matches, this ignores the query parameters of the url.
38 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) OVERRIDE; 41 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) OVERRIDE;
39 42
40 friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>; 43 friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>;
41 44
42 virtual ~ComponentUpdateInterceptor(); 45 virtual ~ComponentUpdateInterceptor();
43 46
44 struct Response { 47 struct Response {
45 FilePath data_path; 48 FilePath data_path;
46 std::string headers; 49 std::string headers;
47 }; 50 };
48 51
49 typedef std::map<GURL, Response> ResponseMap; 52 typedef std::map<GURL, Response> ResponseMap;
50 ResponseMap responses_; 53 ResponseMap responses_;
54 int hit_count_;
51 55
52 DISALLOW_COPY_AND_ASSIGN(ComponentUpdateInterceptor); 56 DISALLOW_COPY_AND_ASSIGN(ComponentUpdateInterceptor);
53 }; 57 };
54 58
55 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ 59 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698