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 #ifndef CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
6 #define CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 6 #define CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 jobject j_observer, | 38 jobject j_observer, |
39 jint num_sites); | 39 jint num_sites); |
40 void GetURLThumbnail(JNIEnv* env, | 40 void GetURLThumbnail(JNIEnv* env, |
41 jobject obj, | 41 jobject obj, |
42 jstring url, | 42 jstring url, |
43 jobject j_callback); | 43 jobject j_callback); |
44 void BlacklistUrl(JNIEnv* env, jobject obj, jstring j_url); | 44 void BlacklistUrl(JNIEnv* env, jobject obj, jstring j_url); |
45 void RecordOpenedMostVisitedItem(JNIEnv* env, jobject obj, jint index); | 45 void RecordOpenedMostVisitedItem(JNIEnv* env, jobject obj, jint index); |
46 | 46 |
47 // ProfileSyncServiceObserver implementation. | 47 // ProfileSyncServiceObserver implementation. |
48 virtual void OnStateChanged() override; | 48 void OnStateChanged() override; |
49 | 49 |
50 // Registers JNI methods. | 50 // Registers JNI methods. |
51 static bool Register(JNIEnv* env); | 51 static bool Register(JNIEnv* env); |
52 | 52 |
53 private: | 53 private: |
54 // The source of the Most Visited sites. | 54 // The source of the Most Visited sites. |
55 enum MostVisitedSource { | 55 enum MostVisitedSource { |
56 TOP_SITES, | 56 TOP_SITES, |
57 SUGGESTIONS_SERVICE | 57 SUGGESTIONS_SERVICE |
58 }; | 58 }; |
59 | 59 |
60 virtual ~MostVisitedSites(); | 60 ~MostVisitedSites() override; |
61 void QueryMostVisitedURLs(); | 61 void QueryMostVisitedURLs(); |
62 | 62 |
63 // Initialize the query to Top Sites. Called if the SuggestionsService is not | 63 // Initialize the query to Top Sites. Called if the SuggestionsService is not |
64 // enabled, or if it returns no data. | 64 // enabled, or if it returns no data. |
65 void InitiateTopSitesQuery(); | 65 void InitiateTopSitesQuery(); |
66 | 66 |
67 // Callback for when data is available from TopSites. | 67 // Callback for when data is available from TopSites. |
68 void OnMostVisitedURLsAvailable( | 68 void OnMostVisitedURLsAvailable( |
69 base::android::ScopedJavaGlobalRef<jobject>* j_observer, | 69 base::android::ScopedJavaGlobalRef<jobject>* j_observer, |
70 int num_sites, | 70 int num_sites, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 MostVisitedSource mv_source_; | 132 MostVisitedSource mv_source_; |
133 | 133 |
134 // For callbacks may be run after destruction. | 134 // For callbacks may be run after destruction. |
135 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 135 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 137 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
138 }; | 138 }; |
139 | 139 |
140 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 140 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
OLD | NEW |