Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1467)

Side by Side Diff: components/ntp_tiles/popular_sites_impl.h

Issue 2695713004: Add baked-in favicons for default popular sites on NTP (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_NTP_TILES_POPULAR_SITES_IMPL_H_ 5 #ifndef COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
6 #define COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_ 6 #define COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "components/ntp_tiles/popular_sites.h" 17 #include "components/ntp_tiles/popular_sites.h"
18 #include "net/url_request/url_fetcher_delegate.h" 18 #include "net/url_request/url_fetcher_delegate.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace base { 21 namespace base {
22 class Value; 22 class Value;
23 } 23 }
24 24
25 namespace net { 25 namespace net {
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
27 } 27 }
28 28
29 namespace favicon {
30 class FaviconService;
31 }
32
29 namespace user_prefs { 33 namespace user_prefs {
30 class PrefRegistrySyncable; 34 class PrefRegistrySyncable;
31 } 35 }
32 36
33 namespace variations { 37 namespace variations {
34 class VariationsService; 38 class VariationsService;
35 } 39 }
36 40
37 class PrefService; 41 class PrefService;
38 class TemplateURLService; 42 class TemplateURLService;
39 43
40 namespace ntp_tiles { 44 namespace ntp_tiles {
41 45
42 using ParseJSONCallback = base::Callback<void( 46 using ParseJSONCallback = base::Callback<void(
43 const std::string& unsafe_json, 47 const std::string& unsafe_json,
44 const base::Callback<void(std::unique_ptr<base::Value>)>& success_callback, 48 const base::Callback<void(std::unique_ptr<base::Value>)>& success_callback,
45 const base::Callback<void(const std::string&)>& error_callback)>; 49 const base::Callback<void(const std::string&)>& error_callback)>;
46 50
47 // Actual (non-test) implementation of the PopularSites interface. Caches the 51 // Actual (non-test) implementation of the PopularSites interface. Caches the
48 // downloaded file on disk to avoid re-downloading on every startup. 52 // downloaded file on disk to avoid re-downloading on every startup.
49 class PopularSitesImpl : public PopularSites, public net::URLFetcherDelegate { 53 class PopularSitesImpl : public PopularSites, public net::URLFetcherDelegate {
50 public: 54 public:
51 PopularSitesImpl( 55 PopularSitesImpl(
52 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, 56 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool,
53 PrefService* prefs, 57 PrefService* prefs,
54 const TemplateURLService* template_url_service, 58 const TemplateURLService* template_url_service,
55 variations::VariationsService* variations_service, 59 variations::VariationsService* variations_service,
60 favicon::FaviconService* favicon_service,
56 net::URLRequestContextGetter* download_context, 61 net::URLRequestContextGetter* download_context,
57 const base::FilePath& directory, 62 const base::FilePath& directory,
58 ParseJSONCallback parse_json); 63 ParseJSONCallback parse_json);
59 64
60 ~PopularSitesImpl() override; 65 ~PopularSitesImpl() override;
61 66
62 // PopularSites implementation. 67 // PopularSites implementation.
63 bool MaybeStartFetch(bool force_download, 68 bool MaybeStartFetch(bool force_download,
64 const FinishedCallback& callback) override; 69 const FinishedCallback& callback) override;
65 const SitesVector& sites() const override; 70 const SitesVector& sites() const override;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 GURL pending_url_; 107 GURL pending_url_;
103 108
104 base::WeakPtrFactory<PopularSitesImpl> weak_ptr_factory_; 109 base::WeakPtrFactory<PopularSitesImpl> weak_ptr_factory_;
105 110
106 DISALLOW_COPY_AND_ASSIGN(PopularSitesImpl); 111 DISALLOW_COPY_AND_ASSIGN(PopularSitesImpl);
107 }; 112 };
108 113
109 } // namespace ntp_tiles 114 } // namespace ntp_tiles
110 115
111 #endif // COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_ 116 #endif // COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698