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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/url_request/url_fetcher_delegate.h" | 10 #include "net/url_request/url_fetcher_delegate.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Requests to |url|. |callback| will be invoked when the function returns | 47 // Requests to |url|. |callback| will be invoked when the function returns |
48 // true, and the request is finished asynchronously. | 48 // true, and the request is finished asynchronously. |
49 // Returns false if the previous request is not finished, or the request | 49 // Returns false if the previous request is not finished, or the request |
50 // is omitted due to retry limitation. | 50 // is omitted due to retry limitation. |
51 bool Request(const GURL& url, const Callback& callback); | 51 bool Request(const GURL& url, const Callback& callback); |
52 | 52 |
53 // Gets internal state. | 53 // Gets internal state. |
54 State state() { return state_; } | 54 State state() { return state_; } |
55 | 55 |
56 // net::URLFetcherDelegate implementation: | 56 // net::URLFetcherDelegate implementation: |
57 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 57 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
58 | 58 |
59 private: | 59 private: |
60 // URL to send the request. | 60 // URL to send the request. |
61 GURL url_; | 61 GURL url_; |
62 | 62 |
63 // ID which is assigned to the URLFetcher. | 63 // ID which is assigned to the URLFetcher. |
64 const int id_; | 64 const int id_; |
65 | 65 |
66 // Internal state. | 66 // Internal state. |
67 enum State state_; | 67 enum State state_; |
(...skipping 13 matching lines...) Expand all Loading... |
81 | 81 |
82 // An extra HTTP request header | 82 // An extra HTTP request header |
83 std::string extra_request_header_; | 83 std::string extra_request_header_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(TranslateURLFetcher); | 85 DISALLOW_COPY_AND_ASSIGN(TranslateURLFetcher); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace translate | 88 } // namespace translate |
89 | 89 |
90 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ | 90 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_URL_FETCHER_H_ |
OLD | NEW |