OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 NET_URL_REQUEST_URL_FETCHER_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ |
6 #define NET_URL_REQUEST_URL_FETCHER_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // fetcher.reset(); | 60 // fetcher.reset(); |
61 // | 61 // |
62 // The object you supply as a delegate must inherit from URLFetcherDelegate. | 62 // The object you supply as a delegate must inherit from URLFetcherDelegate. |
63 // When the fetch is completed, OnURLFetchComplete() will be called with a | 63 // When the fetch is completed, OnURLFetchComplete() will be called with a |
64 // pointer to the URLFetcher. From that point until the original URLFetcher | 64 // pointer to the URLFetcher. From that point until the original URLFetcher |
65 // instance is destroyed, you may use accessor methods to see the result of the | 65 // instance is destroyed, you may use accessor methods to see the result of the |
66 // fetch. You should copy these objects if you need them to live longer than | 66 // fetch. You should copy these objects if you need them to live longer than |
67 // the URLFetcher instance. If the URLFetcher instance is destroyed before the | 67 // the URLFetcher instance. If the URLFetcher instance is destroyed before the |
68 // callback happens, the fetch will be canceled and no callback will occur. | 68 // callback happens, the fetch will be canceled and no callback will occur. |
69 // | 69 // |
70 // You may create the URLFetcher instance on any thread; OnURLFetchComplete() | 70 // You may create the URLFetcher instance on any sequence; OnURLFetchComplete() |
71 // will be called back on the same thread you use to create the instance. | 71 // will be called back on the same sequence you use to create the instance. |
72 // | 72 // |
73 // | 73 // |
74 // NOTE: By default URLFetcher requests are NOT intercepted, except when | 74 // NOTE: By default URLFetcher requests are NOT intercepted, except when |
75 // interception is explicitly enabled in tests. | 75 // interception is explicitly enabled in tests. |
76 class NET_EXPORT URLFetcher { | 76 class NET_EXPORT URLFetcher { |
77 public: | 77 public: |
78 // Imposible http response code. Used to signal that no http response code | 78 // Imposible http response code. Used to signal that no http response code |
79 // was received. | 79 // was received. |
80 enum ResponseCode { | 80 enum ResponseCode { |
81 RESPONSE_CODE_INVALID = -1 | 81 RESPONSE_CODE_INVALID = -1 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // be removed once the URLFetcher is destroyed. User should not take | 329 // be removed once the URLFetcher is destroyed. User should not take |
330 // ownership more than once, or call this method after taking ownership. | 330 // ownership more than once, or call this method after taking ownership. |
331 virtual bool GetResponseAsFilePath( | 331 virtual bool GetResponseAsFilePath( |
332 bool take_ownership, | 332 bool take_ownership, |
333 base::FilePath* out_response_path) const = 0; | 333 base::FilePath* out_response_path) const = 0; |
334 }; | 334 }; |
335 | 335 |
336 } // namespace net | 336 } // namespace net |
337 | 337 |
338 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 338 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
OLD | NEW |