OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/precache/core/precache_fetcher.h" | 5 #include "components/precache/core/precache_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // response to different kinds of fetches, e.g. OnConfigFetchComplete when | 99 // response to different kinds of fetches, e.g. OnConfigFetchComplete when |
100 // configuration settings are fetched, OnManifestFetchComplete when a manifest | 100 // configuration settings are fetched, OnManifestFetchComplete when a manifest |
101 // is fetched, etc. | 101 // is fetched, etc. |
102 class PrecacheFetcher::Fetcher : public net::URLFetcherDelegate { | 102 class PrecacheFetcher::Fetcher : public net::URLFetcherDelegate { |
103 public: | 103 public: |
104 // Construct a new Fetcher. This will create and start a new URLFetcher for | 104 // Construct a new Fetcher. This will create and start a new URLFetcher for |
105 // the specified URL using the specified request context. | 105 // the specified URL using the specified request context. |
106 Fetcher(net::URLRequestContextGetter* request_context, const GURL& url, | 106 Fetcher(net::URLRequestContextGetter* request_context, const GURL& url, |
107 const base::Callback<void(const URLFetcher&)>& callback); | 107 const base::Callback<void(const URLFetcher&)>& callback); |
108 virtual ~Fetcher() {} | 108 virtual ~Fetcher() {} |
109 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 109 virtual void OnURLFetchComplete(const URLFetcher* source) override; |
110 | 110 |
111 private: | 111 private: |
112 const base::Callback<void(const URLFetcher&)> callback_; | 112 const base::Callback<void(const URLFetcher&)> callback_; |
113 scoped_ptr<URLFetcher> url_fetcher_; | 113 scoped_ptr<URLFetcher> url_fetcher_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 115 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
116 }; | 116 }; |
117 | 117 |
118 PrecacheFetcher::Fetcher::Fetcher( | 118 PrecacheFetcher::Fetcher::Fetcher( |
119 net::URLRequestContextGetter* request_context, const GURL& url, | 119 net::URLRequestContextGetter* request_context, const GURL& url, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 StartNextFetch(); | 246 StartNextFetch(); |
247 } | 247 } |
248 | 248 |
249 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { | 249 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { |
250 // The resource has already been put in the cache during the fetch process, so | 250 // The resource has already been put in the cache during the fetch process, so |
251 // nothing more needs to be done for the resource. | 251 // nothing more needs to be done for the resource. |
252 StartNextFetch(); | 252 StartNextFetch(); |
253 } | 253 } |
254 | 254 |
255 } // namespace precache | 255 } // namespace precache |
OLD | NEW |