OLD | NEW |
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_bridge.h" | 5 #include "chrome/browser/android/ntp/most_visited_sites_bridge.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" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 large_icon_urls.emplace_back(site.large_icon_url.spec()); | 150 large_icon_urls.emplace_back(site.large_icon_url.spec()); |
151 } | 151 } |
152 Java_MostVisitedURLsObserver_onPopularURLsAvailable( | 152 Java_MostVisitedURLsObserver_onPopularURLsAvailable( |
153 env, observer_.obj(), ToJavaArrayOfStrings(env, urls).obj(), | 153 env, observer_.obj(), ToJavaArrayOfStrings(env, urls).obj(), |
154 ToJavaArrayOfStrings(env, favicon_urls).obj(), | 154 ToJavaArrayOfStrings(env, favicon_urls).obj(), |
155 ToJavaArrayOfStrings(env, large_icon_urls).obj()); | 155 ToJavaArrayOfStrings(env, large_icon_urls).obj()); |
156 } | 156 } |
157 | 157 |
158 MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile) | 158 MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile) |
159 : supervisor_(profile), | 159 : supervisor_(profile), |
| 160 popular_sites_(BrowserThread::GetBlockingPool(), |
| 161 profile->GetPrefs(), |
| 162 TemplateURLServiceFactory::GetForProfile(profile), |
| 163 g_browser_process->variations_service(), |
| 164 profile->GetRequestContext(), |
| 165 ChromePopularSites::GetDirectory()), |
160 most_visited_(BrowserThread::GetBlockingPool(), | 166 most_visited_(BrowserThread::GetBlockingPool(), |
161 profile->GetPrefs(), | 167 profile->GetPrefs(), |
162 TemplateURLServiceFactory::GetForProfile(profile), | |
163 g_browser_process->variations_service(), | |
164 profile->GetRequestContext(), | |
165 ChromePopularSites::GetDirectory(), | |
166 TopSitesFactory::GetForProfile(profile), | 168 TopSitesFactory::GetForProfile(profile), |
167 SuggestionsServiceFactory::GetForProfile(profile), | 169 SuggestionsServiceFactory::GetForProfile(profile), |
| 170 &popular_sites_, |
168 &supervisor_) { | 171 &supervisor_) { |
169 // Register the thumbnails debugging page. | 172 // Register the thumbnails debugging page. |
170 // TODO(sfiera): find thumbnails a home. They don't belong here. | 173 // TODO(sfiera): find thumbnails a home. They don't belong here. |
171 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); | 174 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); |
172 } | 175 } |
173 | 176 |
174 MostVisitedSitesBridge::~MostVisitedSitesBridge() {} | 177 MostVisitedSitesBridge::~MostVisitedSitesBridge() {} |
175 | 178 |
176 void MostVisitedSitesBridge::Destroy( | 179 void MostVisitedSitesBridge::Destroy( |
177 JNIEnv* env, const JavaParamRef<jobject>& obj) { | 180 JNIEnv* env, const JavaParamRef<jobject>& obj) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 228 } |
226 | 229 |
227 static jlong Init(JNIEnv* env, | 230 static jlong Init(JNIEnv* env, |
228 const JavaParamRef<jobject>& obj, | 231 const JavaParamRef<jobject>& obj, |
229 const JavaParamRef<jobject>& jprofile) { | 232 const JavaParamRef<jobject>& jprofile) { |
230 MostVisitedSitesBridge* most_visited_sites = | 233 MostVisitedSitesBridge* most_visited_sites = |
231 new MostVisitedSitesBridge( | 234 new MostVisitedSitesBridge( |
232 ProfileAndroid::FromProfileAndroid(jprofile)); | 235 ProfileAndroid::FromProfileAndroid(jprofile)); |
233 return reinterpret_cast<intptr_t>(most_visited_sites); | 236 return reinterpret_cast<intptr_t>(most_visited_sites); |
234 } | 237 } |
OLD | NEW |