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 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 virtual ~PrivetURLFetcher(); | 70 virtual ~PrivetURLFetcher(); |
71 | 71 |
72 static void SetTokenForHost(const std::string& host, | 72 static void SetTokenForHost(const std::string& host, |
73 const std::string& token); | 73 const std::string& token); |
74 | 74 |
75 static void ResetTokenMapForTests(); | 75 static void ResetTokenMapForTests(); |
76 | 76 |
77 void DoNotRetryOnTransientError(); | 77 void DoNotRetryOnTransientError(); |
78 | 78 |
79 void AllowEmptyPrivetToken(); | 79 void SendEmptyPrivetToken(); |
80 | 80 |
81 // Set the contents of the Range header. |OnRawData| must return true if this | 81 // Set the contents of the Range header. |OnRawData| must return true if this |
82 // is called. | 82 // is called. |
83 void SetByteRange(int start, int end); | 83 void SetByteRange(int start, int end); |
84 | 84 |
85 // Save the response to a file. |OnRawData| must return true if this is | 85 // Save the response to a file. |OnRawData| must return true if this is |
86 // called. | 86 // called. |
87 void SaveResponseToFile(); | 87 void SaveResponseToFile(); |
88 | 88 |
89 void Start(); | 89 void Start(); |
(...skipping 19 matching lines...) Expand all Loading... |
109 bool PrivetErrorTransient(const std::string& error); | 109 bool PrivetErrorTransient(const std::string& error); |
110 void RequestTokenRefresh(); | 110 void RequestTokenRefresh(); |
111 void RefreshToken(const std::string& token); | 111 void RefreshToken(const std::string& token); |
112 | 112 |
113 GURL url_; | 113 GURL url_; |
114 net::URLFetcher::RequestType request_type_; | 114 net::URLFetcher::RequestType request_type_; |
115 scoped_refptr<net::URLRequestContextGetter> request_context_; | 115 scoped_refptr<net::URLRequestContextGetter> request_context_; |
116 Delegate* delegate_; | 116 Delegate* delegate_; |
117 | 117 |
118 bool do_not_retry_on_transient_error_; | 118 bool do_not_retry_on_transient_error_; |
119 bool allow_empty_privet_token_; | 119 bool send_empty_privet_token_; |
120 bool has_byte_range_; | 120 bool has_byte_range_; |
121 bool make_response_file_; | 121 bool make_response_file_; |
122 | 122 |
123 int byte_range_start_; | 123 int byte_range_start_; |
124 int byte_range_end_; | 124 int byte_range_end_; |
125 | 125 |
126 int tries_; | 126 int tries_; |
127 std::string upload_data_; | 127 std::string upload_data_; |
128 std::string upload_content_type_; | 128 std::string upload_content_type_; |
129 base::FilePath upload_file_path_; | 129 base::FilePath upload_file_path_; |
130 scoped_ptr<net::URLFetcher> url_fetcher_; | 130 scoped_ptr<net::URLFetcher> url_fetcher_; |
131 | 131 |
132 base::WeakPtrFactory<PrivetURLFetcher> weak_factory_; | 132 base::WeakPtrFactory<PrivetURLFetcher> weak_factory_; |
133 DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcher); | 133 DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcher); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace local_discovery | 136 } // namespace local_discovery |
137 | 137 |
138 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ | 138 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ |
OLD | NEW |