OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // TODO(rdsmith): This class needs to delegate URLRequest::Delegate methods | 5 // TODO(rdsmith): This class needs to delegate URLRequest::Delegate methods |
6 // to the net/ embedder for correct implementation of authentication. | 6 // to the net/ embedder for correct implementation of authentication. |
7 // Specifically, this class needs the embedder to provide functionality | 7 // Specifically, this class needs the embedder to provide functionality |
8 // corresponding to | 8 // corresponding to |
9 // URLRequest::Delegate::{OnAuthRequired,OnCertificateRequested}. | 9 // URLRequest::Delegate::{OnAuthRequired,OnCertificateRequested}. |
10 | 10 |
11 #ifndef NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ | 11 #ifndef NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ |
12 #define NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ | 12 #define NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
20 #include "net/base/sdch_manager.h" | 20 #include "net/base/sdch_manager.h" |
21 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 | 26 |
27 class BoundNetLog; | 27 class NetLogWithSource; |
28 class URLRequest; | 28 class URLRequest; |
29 class URLRequestThrottlerEntryInterface; | 29 class URLRequestThrottlerEntryInterface; |
30 | 30 |
31 // This class is used by embedder SDCH policy object to fetch | 31 // This class is used by embedder SDCH policy object to fetch |
32 // dictionaries. It queues requests for dictionaries and dispatches | 32 // dictionaries. It queues requests for dictionaries and dispatches |
33 // them serially, implementing the URLRequest::Delegate interface to | 33 // them serially, implementing the URLRequest::Delegate interface to |
34 // handle callbacks (but see above TODO). It tracks all requests, only | 34 // handle callbacks (but see above TODO). It tracks all requests, only |
35 // attempting to fetch each dictionary once. | 35 // attempting to fetch each dictionary once. |
36 class NET_EXPORT SdchDictionaryFetcher : public URLRequest::Delegate, | 36 class NET_EXPORT SdchDictionaryFetcher : public URLRequest::Delegate, |
37 public base::NonThreadSafe { | 37 public base::NonThreadSafe { |
38 public: | 38 public: |
39 typedef base::Callback<void(const std::string& dictionary_text, | 39 typedef base::Callback<void(const std::string& dictionary_text, |
40 const GURL& dictionary_url, | 40 const GURL& dictionary_url, |
41 const BoundNetLog& net_log, | 41 const NetLogWithSource& net_log, |
42 bool was_from_cache)> | 42 bool was_from_cache)> |
43 OnDictionaryFetchedCallback; | 43 OnDictionaryFetchedCallback; |
44 | 44 |
45 // The consumer must guarantee that |*context| outlives this object. | 45 // The consumer must guarantee that |*context| outlives this object. |
46 explicit SdchDictionaryFetcher(URLRequestContext* context); | 46 explicit SdchDictionaryFetcher(URLRequestContext* context); |
47 ~SdchDictionaryFetcher() override; | 47 ~SdchDictionaryFetcher() override; |
48 | 48 |
49 // Request a new dictionary fetch. The callback will be called | 49 // Request a new dictionary fetch. The callback will be called |
50 // only if the dictionary is successfully fetched. Returns true if a | 50 // only if the dictionary is successfully fetched. Returns true if a |
51 // request for |dictionary_url| has been scheduled, and false otherwise. | 51 // request for |dictionary_url| has been scheduled, and false otherwise. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Store the URLRequestContext associated with the owning SdchManager for | 120 // Store the URLRequestContext associated with the owning SdchManager for |
121 // use while fetching. | 121 // use while fetching. |
122 URLRequestContext* const context_; | 122 URLRequestContext* const context_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); | 124 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace net | 127 } // namespace net |
128 | 128 |
129 #endif // NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ | 129 #endif // NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ |
OLD | NEW |