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/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "net/url_request/url_fetcher.h" | 13 #include "net/url_request/url_fetcher.h" |
14 #include "net/url_request/url_fetcher_delegate.h" | 14 #include "net/url_request/url_fetcher_delegate.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class FilePath; | 19 class FilePath; |
20 } | 20 } |
21 | 21 |
22 namespace local_discovery { | 22 namespace local_discovery { |
23 | 23 |
24 const int kPrivetHTTPCodeInternalFailure = -1; | |
25 | |
26 // Privet-specific URLFetcher adapter. Currently supports only the subset | 24 // Privet-specific URLFetcher adapter. Currently supports only the subset |
27 // of HTTP features required by Privet for GCP 1.5 | 25 // of HTTP features required by Privet for GCP 1.5 |
28 // (/privet/info and /privet/register). | 26 // (/privet/info and /privet/register). |
29 class PrivetURLFetcher : public net::URLFetcherDelegate { | 27 class PrivetURLFetcher : public net::URLFetcherDelegate { |
30 public: | 28 public: |
31 enum ErrorType { | 29 enum ErrorType { |
32 JSON_PARSE_ERROR, | 30 JSON_PARSE_ERROR, |
33 URL_FETCH_ERROR, | 31 URL_FETCH_ERROR, |
34 RESPONSE_CODE_ERROR, | 32 RESPONSE_CODE_ERROR, |
35 RETRY_ERROR, | 33 RETRY_ERROR, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 base::FilePath upload_file_path_; | 136 base::FilePath upload_file_path_; |
139 scoped_ptr<net::URLFetcher> url_fetcher_; | 137 scoped_ptr<net::URLFetcher> url_fetcher_; |
140 | 138 |
141 base::WeakPtrFactory<PrivetURLFetcher> weak_factory_; | 139 base::WeakPtrFactory<PrivetURLFetcher> weak_factory_; |
142 DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcher); | 140 DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcher); |
143 }; | 141 }; |
144 | 142 |
145 } // namespace local_discovery | 143 } // namespace local_discovery |
146 | 144 |
147 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ | 145 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_ |
OLD | NEW |