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

Side by Side Diff: chrome/browser/android/popular_sites.h

Issue 1265983007: Popular sites on the NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_POPULAR_SITES_H_
6 #define CHROME_BROWSER_ANDROID_POPULAR_SITES_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15
16 namespace base {
17 class FilePath;
18 }
19
20 namespace net {
21 class URLRequestContextGetter;
22 }
23
24 class FileDownloader;
25
26 class PopularSites {
Bernhard Bauer 2015/08/03 17:04:51 Document this class?
Marc Treib 2015/08/04 08:16:42 Done.
27 public:
28 struct Site {
29 Site(const std::string& title, const std::string& url);
30
31 std::string title;
Bernhard Bauer 2015/08/03 17:04:51 Can this be a base::string16?
Marc Treib 2015/08/04 08:16:42 It could, but why? We're getting UTF8 from the jso
Bernhard Bauer 2015/08/04 08:30:02 It's a user-visible string, and we tend to store t
Marc Treib 2015/08/04 08:58:42 Alright, done.
32 std::string url;
Bernhard Bauer 2015/08/03 17:04:51 And this a GURL?
Marc Treib 2015/08/04 08:16:42 Hm, yeah, I guess that makes for a somewhat cleane
33 };
34
35 using FinishedCallback = base::Callback<void(bool /* success */)>;
36
37 PopularSites(net::URLRequestContextGetter* request_context,
38 const FinishedCallback& callback);
39 ~PopularSites();
40
41 const std::vector<Site>& sites() const { return sites_; }
42
43 private:
44 void OnDownloadDone(const base::FilePath& path, bool success);
45 void OnJsonParsed(scoped_ptr<std::vector<Site>> sites);
46
47 FinishedCallback callback_;
48 scoped_ptr<FileDownloader> downloader_;
49 std::vector<Site> sites_;
50
51 base::WeakPtrFactory<PopularSites> weak_ptr_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(PopularSites);
54 };
55
56 #endif // CHROME_BROWSER_ANDROID_POPULAR_SITES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698