Index: chrome/browser/local_discovery/privet_url_fetcher.h |
diff --git a/chrome/browser/local_discovery/privet_url_fetcher.h b/chrome/browser/local_discovery/privet_url_fetcher.h |
index f3b7405378d0cc73385b7162db9ac81ef0ef5479..d173609142b28c9b7215fcca4e7c9ebf2859dc71 100644 |
--- a/chrome/browser/local_discovery/privet_url_fetcher.h |
+++ b/chrome/browser/local_discovery/privet_url_fetcher.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include "base/file_util.h" |
Vitaly Buka (NO REVIEWS)
2014/02/07 19:47:39
one should be enough
Noam Samuel
2014/02/12 20:25:16
Done.
|
+#include "base/file_util.h" |
#include "base/memory/weak_ptr.h" |
#include "base/values.h" |
#include "net/url_request/url_fetcher.h" |
@@ -51,6 +52,11 @@ class PrivetURLFetcher : public net::URLFetcherDelegate { |
virtual void OnParsedJson(PrivetURLFetcher* fetcher, |
const base::DictionaryValue* value, |
bool has_error) = 0; |
+ |
+ virtual void OnRawData(PrivetURLFetcher* fetcher, |
+ bool response_is_file, |
+ const std::string& data_string, |
+ const base::FilePath& data_file) {} |
}; |
PrivetURLFetcher( |
@@ -65,6 +71,18 @@ class PrivetURLFetcher : public net::URLFetcherDelegate { |
void AllowEmptyPrivetToken(); |
+ // If this method is called, the data will not be parsed as JSON, and |
+ // |OnRawData| will be called instead of |OnParsedJson|. In addition, |
+ // HTTP code 418 will be treated as an invalid_x_privet_token error. |
+ void DoNotParseData(); |
+ |
+ // Set the contents of the Range header. This is only valid for requests that |
+ // call |DoNotParseData|. |
+ void SetByteRange(int start, int end); |
+ |
+ // Save the response to a file. Only valid when used with |DoNotParseData|. |
+ void SaveResponseToFile(); |
+ |
void Start(); |
void SetUploadData(const std::string& upload_content_type, |
@@ -74,6 +92,8 @@ class PrivetURLFetcher : public net::URLFetcherDelegate { |
const base::FilePath& upload_file_path); |
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
+ void OnURLFetchCompleteParseData(const net::URLFetcher* source); |
+ void OnURLFetchCompleteDoNotParseData(const net::URLFetcher* source); |
const GURL& url() const { return url_fetcher_->GetOriginalURL(); } |
int response_code() const { return url_fetcher_->GetResponseCode(); } |
@@ -93,6 +113,12 @@ class PrivetURLFetcher : public net::URLFetcherDelegate { |
bool do_not_retry_on_transient_error_; |
bool allow_empty_privet_token_; |
+ bool do_not_parse_data_; |
+ bool has_byte_range_; |
+ bool make_response_file_; |
+ |
+ int byte_range_start_; |
+ int byte_range_end_; |
int tries_; |
std::string upload_data_; |