Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_POPULAR_SITES_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ |
| 6 #define CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ | 6 #define CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 ~Site(); | 38 ~Site(); |
| 39 | 39 |
| 40 base::string16 title; | 40 base::string16 title; |
| 41 GURL url; | 41 GURL url; |
| 42 GURL favicon_url; | 42 GURL favicon_url; |
| 43 GURL thumbnail_url; | 43 GURL thumbnail_url; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 using FinishedCallback = base::Callback<void(bool /* success */)>; | 46 using FinishedCallback = base::Callback<void(bool /* success */)>; |
| 47 | 47 |
| 48 // Usually, the name of the file that's downloaded is based on the user's | |
| 49 // locale. |filename|, if non-empty, will override that default name. | |
| 48 PopularSites(Profile* profile, | 50 PopularSites(Profile* profile, |
| 49 const std::string& filename, | 51 const std::string& filename, |
| 50 net::URLRequestContextGetter* request_context, | |
|
Marc Treib
2015/09/09 16:24:01
Unrelated: There's no need to pass this explicitly
| |
| 51 const FinishedCallback& callback); | 52 const FinishedCallback& callback); |
| 52 ~PopularSites(); | 53 ~PopularSites(); |
| 53 | 54 |
| 54 const std::vector<Site>& sites() const { return sites_; } | 55 const std::vector<Site>& sites() const { return sites_; } |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 void OnDownloadDone(const base::FilePath& path, bool success); | 58 void OnDownloadDone(const base::FilePath& path, bool success); |
| 58 void OnJsonParsed(scoped_ptr<std::vector<Site>> sites); | 59 void OnJsonParsed(scoped_ptr<std::vector<Site>> sites); |
| 59 | 60 |
| 60 FinishedCallback callback_; | 61 FinishedCallback callback_; |
| 61 scoped_ptr<FileDownloader> downloader_; | 62 scoped_ptr<FileDownloader> downloader_; |
| 62 std::vector<Site> sites_; | 63 std::vector<Site> sites_; |
| 63 | 64 |
| 64 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; | 65 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(PopularSites); | 67 DISALLOW_COPY_AND_ASSIGN(PopularSites); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 #endif // CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ | 70 #endif // CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ |
| OLD | NEW |