| 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 28 matching lines...) Expand all Loading... |
| 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 | 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. | 49 // locale. |override_country| (if non-empty) is used to override the |
| 50 // auto-detected country. |override_version|, if non-empty, will |
| 51 // override the baked-in default version. |
| 52 // |override_filename|, if non-empty, will override the full filename |
| 53 // (so |override_country| and |override_version| are ignored in this case). |
| 54 // TODO(treib): Get rid of |override_filename|. |
| 50 PopularSites(Profile* profile, | 55 PopularSites(Profile* profile, |
| 51 const std::string& filename, | 56 const std::string& override_country, |
| 57 const std::string& override_version, |
| 58 const std::string& override_filename, |
| 52 const FinishedCallback& callback); | 59 const FinishedCallback& callback); |
| 53 ~PopularSites(); | 60 ~PopularSites(); |
| 54 | 61 |
| 55 const std::vector<Site>& sites() const { return sites_; } | 62 const std::vector<Site>& sites() const { return sites_; } |
| 56 | 63 |
| 57 private: | 64 private: |
| 58 void OnDownloadDone(const base::FilePath& path, bool success); | 65 void OnDownloadDone(const base::FilePath& path, bool success); |
| 59 void OnJsonParsed(scoped_ptr<std::vector<Site>> sites); | 66 void OnJsonParsed(scoped_ptr<std::vector<Site>> sites); |
| 60 | 67 |
| 61 FinishedCallback callback_; | 68 FinishedCallback callback_; |
| 62 scoped_ptr<FileDownloader> downloader_; | 69 scoped_ptr<FileDownloader> downloader_; |
| 63 std::vector<Site> sites_; | 70 std::vector<Site> sites_; |
| 64 | 71 |
| 65 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; | 72 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; |
| 66 | 73 |
| 67 DISALLOW_COPY_AND_ASSIGN(PopularSites); | 74 DISALLOW_COPY_AND_ASSIGN(PopularSites); |
| 68 }; | 75 }; |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ | 77 #endif // CHROME_BROWSER_ANDROID_POPULAR_SITES_H_ |
| OLD | NEW |