| Index: components/ntp_tiles/most_visited_sites.cc
|
| diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
|
| index 236ad773be75d2115c55005df7537931612c60dc..ee951a3322c47d90916834030913710b0b197ef5 100644
|
| --- a/components/ntp_tiles/most_visited_sites.cc
|
| +++ b/components/ntp_tiles/most_visited_sites.cc
|
| @@ -9,6 +9,10 @@
|
| #include <string>
|
| #include <utility>
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include <jni.h>
|
| +#endif
|
| +
|
| #include "base/callback.h"
|
| #include "base/command_line.h"
|
| #include "base/feature_list.h"
|
| @@ -27,6 +31,11 @@
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "components/prefs/pref_service.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "base/android/jni_android.h"
|
| +#include "jni/MostVisitedSites_jni.h"
|
| +#endif
|
| +
|
| using history::TopSites;
|
| using suggestions::ChromeSuggestion;
|
| using suggestions::SuggestionsProfile;
|
| @@ -66,11 +75,21 @@ bool ShouldShowPopularSites() {
|
| // UMA reports the correct group.
|
| const std::string group_name =
|
| base::FieldTrialList::FindFullName(kPopularSitesFieldTrialName);
|
| +
|
| base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
|
| if (cmd_line->HasSwitch(switches::kDisableNTPPopularSites))
|
| return false;
|
| +
|
| if (cmd_line->HasSwitch(switches::kEnableNTPPopularSites))
|
| return true;
|
| +
|
| +#if defined(OS_ANDROID)
|
| + if (Java_MostVisitedSites_isPopularSitesForceEnabled(
|
| + base::android::AttachCurrentThread())) {
|
| + return true;
|
| + }
|
| +#endif
|
| +
|
| return base::StartsWith(group_name, "Enabled",
|
| base::CompareCase::INSENSITIVE_ASCII);
|
| }
|
| @@ -166,6 +185,13 @@ MostVisitedSites::~MostVisitedSites() {
|
| supervisor_->SetObserver(nullptr);
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +// static
|
| +bool MostVisitedSites::Register(JNIEnv* env) {
|
| + return RegisterNativesImpl(env);
|
| +}
|
| +#endif
|
| +
|
| void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer,
|
| int num_sites) {
|
| DCHECK(observer);
|
|
|