| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile) | 89 MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile) |
| 90 : most_visited_(ChromeMostVisitedSitesFactory::NewForProfile(profile)) { | 90 : most_visited_(ChromeMostVisitedSitesFactory::NewForProfile(profile)) { |
| 91 // Register the thumbnails debugging page. | 91 // Register the thumbnails debugging page. |
| 92 // TODO(sfiera): find thumbnails a home. They don't belong here. | 92 // TODO(sfiera): find thumbnails a home. They don't belong here. |
| 93 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); | 93 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); |
| 94 DCHECK(!profile->IsOffTheRecord()); | 94 DCHECK(!profile->IsOffTheRecord()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 MostVisitedSitesBridge::~MostVisitedSitesBridge() {} | 97 MostVisitedSitesBridge::~MostVisitedSitesBridge() {} |
| 98 | 98 |
| 99 void MostVisitedSitesBridge::Destroy( | 99 void MostVisitedSitesBridge::Destroy(JNIEnv* env, |
| 100 JNIEnv* env, const JavaParamRef<jobject>& obj) { | 100 const JavaParamRef<jobject>& obj) { |
| 101 delete this; | 101 delete this; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void MostVisitedSitesBridge::SetObserver( | 104 void MostVisitedSitesBridge::SetObserver( |
| 105 JNIEnv* env, | 105 JNIEnv* env, |
| 106 const JavaParamRef<jobject>& obj, | 106 const JavaParamRef<jobject>& obj, |
| 107 const JavaParamRef<jobject>& j_observer, | 107 const JavaParamRef<jobject>& j_observer, |
| 108 jint num_sites) { | 108 jint num_sites) { |
| 109 java_observer_.reset(new JavaObserver(env, j_observer)); | 109 java_observer_.reset(new JavaObserver(env, j_observer)); |
| 110 most_visited_->SetMostVisitedURLsObserver(java_observer_.get(), num_sites); | 110 most_visited_->SetMostVisitedURLsObserver(java_observer_.get(), num_sites); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 bool MostVisitedSitesBridge::Register(JNIEnv* env) { | 163 bool MostVisitedSitesBridge::Register(JNIEnv* env) { |
| 164 return RegisterNativesImpl(env); | 164 return RegisterNativesImpl(env); |
| 165 } | 165 } |
| 166 | 166 |
| 167 static jlong Init(JNIEnv* env, | 167 static jlong Init(JNIEnv* env, |
| 168 const JavaParamRef<jobject>& obj, | 168 const JavaParamRef<jobject>& obj, |
| 169 const JavaParamRef<jobject>& jprofile) { | 169 const JavaParamRef<jobject>& jprofile) { |
| 170 MostVisitedSitesBridge* most_visited_sites = | 170 MostVisitedSitesBridge* most_visited_sites = |
| 171 new MostVisitedSitesBridge( | 171 new MostVisitedSitesBridge(ProfileAndroid::FromProfileAndroid(jprofile)); |
| 172 ProfileAndroid::FromProfileAndroid(jprofile)); | |
| 173 return reinterpret_cast<intptr_t>(most_visited_sites); | 172 return reinterpret_cast<intptr_t>(most_visited_sites); |
| 174 } | 173 } |
| OLD | NEW |