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

Side by Side Diff: chrome/browser/android/ntp/most_visited_sites.cc

Issue 1887403002: Create a WebUIController for chrome://suggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move SuggestionsSource Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/android/ntp/most_visited_sites.h" 5 #include "chrome/browser/android/ntp/most_visited_sites.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/metrics/sparse_histogram.h" 17 #include "base/metrics/sparse_histogram.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "chrome/browser/android/ntp/popular_sites.h" 23 #include "chrome/browser/android/ntp/popular_sites.h"
24 #include "chrome/browser/history/top_sites_factory.h" 24 #include "chrome/browser/history/top_sites_factory.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/profiles/profile_android.h" 26 #include "chrome/browser/profiles/profile_android.h"
27 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" 27 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
28 #include "chrome/browser/search/suggestions/suggestions_source.h"
29 #include "chrome/browser/supervised_user/supervised_user_service.h" 28 #include "chrome/browser/supervised_user/supervised_user_service.h"
30 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 29 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
31 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" 30 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
32 #include "chrome/browser/thumbnails/thumbnail_list_source.h" 31 #include "chrome/browser/thumbnails/thumbnail_list_source.h"
33 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
35 #include "components/history/core/browser/top_sites.h" 34 #include "components/history/core/browser/top_sites.h"
36 #include "components/pref_registry/pref_registry_syncable.h" 35 #include "components/pref_registry/pref_registry_syncable.h"
37 #include "components/prefs/pref_service.h" 36 #include "components/prefs/pref_service.h"
38 #include "components/variations/variations_associated_data.h" 37 #include "components/variations/variations_associated_data.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 : kHistogramServerName; 215 : kHistogramServerName;
217 } 216 }
218 NOTREACHED(); 217 NOTREACHED();
219 return std::string(); 218 return std::string();
220 } 219 }
221 220
222 MostVisitedSites::MostVisitedSites(Profile* profile) 221 MostVisitedSites::MostVisitedSites(Profile* profile)
223 : profile_(profile), num_sites_(0), received_most_visited_sites_(false), 222 : profile_(profile), num_sites_(0), received_most_visited_sites_(false),
224 received_popular_sites_(false), recorded_uma_(false), 223 received_popular_sites_(false), recorded_uma_(false),
225 scoped_observer_(this), weak_ptr_factory_(this) { 224 scoped_observer_(this), weak_ptr_factory_(this) {
226 // Register the debugging page for the Suggestions Service and the thumbnails 225 // Register the thumbnails debugging page.
227 // debugging page.
228 content::URLDataSource::Add(profile_,
229 new suggestions::SuggestionsSource(profile_));
230 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); 226 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_));
231 227
232 SupervisedUserService* supervised_user_service = 228 SupervisedUserService* supervised_user_service =
233 SupervisedUserServiceFactory::GetForProfile(profile_); 229 SupervisedUserServiceFactory::GetForProfile(profile_);
234 supervised_user_service->AddObserver(this); 230 supervised_user_service->AddObserver(this);
235 } 231 }
236 232
237 MostVisitedSites::~MostVisitedSites() { 233 MostVisitedSites::~MostVisitedSites() {
238 SupervisedUserService* supervised_user_service = 234 SupervisedUserService* supervised_user_service =
239 SupervisedUserServiceFactory::GetForProfile(profile_); 235 SupervisedUserServiceFactory::GetForProfile(profile_);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 927 }
932 } 928 }
933 929
934 static jlong Init(JNIEnv* env, 930 static jlong Init(JNIEnv* env,
935 const JavaParamRef<jobject>& obj, 931 const JavaParamRef<jobject>& obj,
936 const JavaParamRef<jobject>& jprofile) { 932 const JavaParamRef<jobject>& jprofile) {
937 MostVisitedSites* most_visited_sites = 933 MostVisitedSites* most_visited_sites =
938 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); 934 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile));
939 return reinterpret_cast<intptr_t>(most_visited_sites); 935 return reinterpret_cast<intptr_t>(most_visited_sites);
940 } 936 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698