OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // |request_context| is unowned; the caller must ensure that this object does | 36 // |request_context| is unowned; the caller must ensure that this object does |
37 // not outlive it. | 37 // not outlive it. |
38 DeviceDescriptionFetcher( | 38 DeviceDescriptionFetcher( |
39 const GURL& device_description_url, | 39 const GURL& device_description_url, |
40 net::URLRequestContextGetter* request_context, | 40 net::URLRequestContextGetter* request_context, |
41 base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb, | 41 base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb, |
42 base::OnceCallback<void(const std::string&)> error_cb); | 42 base::OnceCallback<void(const std::string&)> error_cb); |
43 | 43 |
44 ~DeviceDescriptionFetcher() override; | 44 ~DeviceDescriptionFetcher() override; |
45 | 45 |
| 46 const GURL& device_description_url() { return device_description_url_; } |
| 47 |
46 void Start(); | 48 void Start(); |
47 | 49 |
48 private: | 50 private: |
49 // net::URLFetcherDelegate implementation. | 51 // net::URLFetcherDelegate implementation. |
50 void OnURLFetchComplete(const net::URLFetcher* source) override; | 52 void OnURLFetchComplete(const net::URLFetcher* source) override; |
51 void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 53 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
52 int64_t current, | 54 int64_t current, |
53 int64_t total, | 55 int64_t total, |
54 int64_t current_network_bytes) override; | 56 int64_t current_network_bytes) override; |
55 void OnURLFetchUploadProgress(const net::URLFetcher* source, | 57 void OnURLFetchUploadProgress(const net::URLFetcher* source, |
56 int64_t current, | 58 int64_t current, |
57 int64_t total) override; | 59 int64_t total) override; |
58 | 60 |
59 // Runs |error_cb_| with |message| and clears it. | 61 // Runs |error_cb_| with |message| and clears it. |
60 void ReportError(const std::string& message); | 62 void ReportError(const std::string& message); |
61 | 63 |
62 const GURL device_description_url_; | 64 const GURL device_description_url_; |
63 const scoped_refptr<net::URLRequestContextGetter> request_context_; | 65 const scoped_refptr<net::URLRequestContextGetter> request_context_; |
64 base::ThreadChecker thread_checker_; | 66 base::ThreadChecker thread_checker_; |
65 | 67 |
66 base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb_; | 68 base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb_; |
67 base::OnceCallback<void(const std::string&)> error_cb_; | 69 base::OnceCallback<void(const std::string&)> error_cb_; |
68 std::unique_ptr<net::URLFetcher> fetcher_; | 70 std::unique_ptr<net::URLFetcher> fetcher_; |
69 }; | 71 }; |
70 | 72 |
71 } // namespace media_router | 73 } // namespace media_router |
72 | 74 |
73 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER
_H_ | 75 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DEVICE_DESCRIPTION_FETCHER
_H_ |
OLD | NEW |