| 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 COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 ~DistillerURLFetcher() override; | 37 ~DistillerURLFetcher() override; |
| 38 | 38 |
| 39 // Indicates when a fetch is done. | 39 // Indicates when a fetch is done. |
| 40 typedef base::Callback<void(const std::string& data)> URLFetcherCallback; | 40 typedef base::Callback<void(const std::string& data)> URLFetcherCallback; |
| 41 | 41 |
| 42 // Fetches a |url|. Notifies when the fetch is done via |callback|. | 42 // Fetches a |url|. Notifies when the fetch is done via |callback|. |
| 43 virtual void FetchURL(const std::string& url, | 43 virtual void FetchURL(const std::string& url, |
| 44 const URLFetcherCallback& callback); | 44 const URLFetcherCallback& callback); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual scoped_ptr<net::URLFetcher> CreateURLFetcher( | 47 virtual std::unique_ptr<net::URLFetcher> CreateURLFetcher( |
| 48 net::URLRequestContextGetter* context_getter, | 48 net::URLRequestContextGetter* context_getter, |
| 49 const std::string& url); | 49 const std::string& url); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // net::URLFetcherDelegate: | 52 // net::URLFetcherDelegate: |
| 53 void OnURLFetchComplete(const net::URLFetcher* source) override; | 53 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 54 | 54 |
| 55 scoped_ptr<net::URLFetcher> url_fetcher_; | 55 std::unique_ptr<net::URLFetcher> url_fetcher_; |
| 56 URLFetcherCallback callback_; | 56 URLFetcherCallback callback_; |
| 57 net::URLRequestContextGetter* context_getter_; | 57 net::URLRequestContextGetter* context_getter_; |
| 58 DISALLOW_COPY_AND_ASSIGN(DistillerURLFetcher); | 58 DISALLOW_COPY_AND_ASSIGN(DistillerURLFetcher); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace dom_distiller | 61 } // namespace dom_distiller |
| 62 | 62 |
| 63 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ | 63 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_URL_FETCHER_H_ |
| OLD | NEW |