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

Unified Diff: chrome/browser/android/most_visited_sites.h

Issue 1330773002: [Android] Persist ordering of NTP suggestions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/most_visited_sites.h
diff --git a/chrome/browser/android/most_visited_sites.h b/chrome/browser/android/most_visited_sites.h
index 4ecc9676c53e187daa9a3a4bdd2d9d32013f13d7..45c360c4b5fe4566fd9b553243bd945edd594ed4 100644
--- a/chrome/browser/android/most_visited_sites.h
+++ b/chrome/browser/android/most_visited_sites.h
@@ -15,7 +15,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
-#include "chrome/browser/profiles/profile.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/top_sites_observer.h"
#include "components/suggestions/proto/suggestions.pb.h"
@@ -25,8 +24,13 @@ namespace suggestions {
class SuggestionsService;
}
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
class GURL;
class PopularSites;
+class Profile;
// Provides the list of most visited sites and their thumbnails to Java.
class MostVisitedSites : public sync_driver::SyncServiceObserver,
@@ -53,6 +57,8 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver,
// Registers JNI methods.
static bool Register(JNIEnv* env);
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
private:
friend class MostVisitedSitesTest;
@@ -80,18 +86,32 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver,
// Adds the suggestions from |popular_sites_| into |titles| and |urls|. This
Marc Treib 2015/09/07 11:13:00 Comment isn't accurate anymore now.
knn 2015/09/08 10:48:56 Done.
// might reorder |titles| and |urls| to retain the absolute positions of the
// popular suggestions. Also updates |tile_sources_| accordingly.
- void AddPopularSites(std::vector<base::string16>* titles,
- std::vector<std::string>* urls);
+ void AddPopularSites(std::vector<base::string16>* result_titles,
+ std::vector<std::string>* result_urls,
+ std::vector<base::string16>* personal_titles,
+ std::vector<std::string>* personal_urls);
// Workhorse for AddPopularSites above. Implemented as a separate static
// method for ease of testing.
- static void AddPopularSitesImpl(
- int num_sites,
- const std::vector<base::string16>& popular_titles,
- const std::vector<std::string>& popular_urls,
- std::vector<base::string16>* titles,
- std::vector<std::string>* urls,
- std::vector<std::string>* tile_sources);
+ static void MergeSuggestions(
+ // Return values.
Marc Treib 2015/09/07 11:13:00 nit: Order of arguments should be inputs, then out
knn 2015/09/08 10:48:56 Done.
+ std::vector<bool>* result_is_personal,
+ std::vector<std::string>* result_urls,
+ std::vector<base::string16>* result_titles,
+ // Arguments.
+ size_t num_tiles,
+ size_t num_personal_suggestions,
+ size_t num_popular_suggestions,
+ // Passed as ptr for move semantics only.
+ std::vector<std::string>* personal_urls,
+ std::vector<base::string16>* personal_titles,
+ std::vector<std::string>* popular_urls,
+ std::vector<base::string16>* popular_titles,
+ const std::vector<std::string>& personal_hosts,
+ const std::vector<std::string>& popular_hosts,
+ const std::vector<std::string>& old_sites_url,
+ // Whether the site is a personal suggestion.
+ const std::vector<bool>& old_sites_source);
// Notify the Java side observer about the availability of Most Visited Urls.
void NotifyMostVisitedURLsObserver(const std::vector<base::string16>& titles,
« no previous file with comments | « no previous file | chrome/browser/android/most_visited_sites.cc » ('j') | chrome/browser/android/most_visited_sites.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698