#ifndef CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_
#define CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
namespace suggestions {
class SuggestionsProfile;
}
class MostVisitedSites : public content::NotificationObserver {
public:
explicit MostVisitedSites(Profile* profile);
void Destroy(JNIEnv* env, jobject obj);
void SetMostVisitedURLsObserver(JNIEnv* env,
jobject obj,
jobject j_observer,
jint num_sites);
void GetURLThumbnail(JNIEnv* env,
jobject obj,
jstring url,
jobject j_callback);
void BlacklistUrl(JNIEnv* env, jobject obj, jstring j_url);
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
static bool Register(JNIEnv* env);
private:
virtual ~MostVisitedSites();
void QueryMostVisitedURLs();
void InitiateTopSitesQuery();
void OnSuggestionsProfileAvailable(
base::android::ScopedJavaGlobalRef<jobject>* j_observer,
const suggestions::SuggestionsProfile& suggestions_profile);
Profile* profile_;
base::android::ScopedJavaGlobalRef<jobject> observer_;
int num_sites_;
base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_;
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
};
#endif