| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const content::NotificationSource& source, | 49 const content::NotificationSource& source, |
| 50 const content::NotificationDetails& details) OVERRIDE; | 50 const content::NotificationDetails& details) OVERRIDE; |
| 51 | 51 |
| 52 // ProfileSyncServiceObserver implementation. | 52 // ProfileSyncServiceObserver implementation. |
| 53 virtual void OnStateChanged() OVERRIDE; | 53 virtual void OnStateChanged() OVERRIDE; |
| 54 | 54 |
| 55 // Registers JNI methods. | 55 // Registers JNI methods. |
| 56 static bool Register(JNIEnv* env); | 56 static bool Register(JNIEnv* env); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // The source of the Most Visited sites. |
| 60 enum MostVisitedSource { |
| 61 TOP_SITES, |
| 62 SUGGESTIONS_SERVICE |
| 63 }; |
| 64 |
| 59 virtual ~MostVisitedSites(); | 65 virtual ~MostVisitedSites(); |
| 60 void QueryMostVisitedURLs(); | 66 void QueryMostVisitedURLs(); |
| 61 | 67 |
| 62 // Initialize the query to Top Sites. Called if the SuggestionsService is not | 68 // Initialize the query to Top Sites. Called if the SuggestionsService is not |
| 63 // enabled, or if it returns no data. | 69 // enabled, or if it returns no data. |
| 64 void InitiateTopSitesQuery(); | 70 void InitiateTopSitesQuery(); |
| 65 | 71 |
| 66 // Callback for when data is available from TopSites. | 72 // Callback for when data is available from TopSites. |
| 67 void OnMostVisitedURLsAvailable( | 73 void OnMostVisitedURLsAvailable( |
| 68 base::android::ScopedJavaGlobalRef<jobject>* j_observer, | 74 base::android::ScopedJavaGlobalRef<jobject>* j_observer, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 int num_local_thumbs_; | 118 int num_local_thumbs_; |
| 113 // Number of tiles for which a server thumbnail is provided. | 119 // Number of tiles for which a server thumbnail is provided. |
| 114 int num_server_thumbs_; | 120 int num_server_thumbs_; |
| 115 // Number of tiles for which no thumbnail is found/specified and a gray tile | 121 // Number of tiles for which no thumbnail is found/specified and a gray tile |
| 116 // is used as the main tile. | 122 // is used as the main tile. |
| 117 int num_empty_thumbs_; | 123 int num_empty_thumbs_; |
| 118 | 124 |
| 119 // Copy of the server suggestions (if enabled). Used for logging. | 125 // Copy of the server suggestions (if enabled). Used for logging. |
| 120 suggestions::SuggestionsProfile server_suggestions_; | 126 suggestions::SuggestionsProfile server_suggestions_; |
| 121 | 127 |
| 128 content::NotificationRegistrar registrar_; |
| 129 |
| 130 MostVisitedSource mv_source_; |
| 131 |
| 122 // For callbacks may be run after destruction. | 132 // For callbacks may be run after destruction. |
| 123 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 133 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 124 | 134 |
| 125 content::NotificationRegistrar registrar_; | |
| 126 | |
| 127 // The source of the Most Visited sites. | |
| 128 enum MostVisitedSource { | |
| 129 TOP_SITES, | |
| 130 SUGGESTIONS_SERVICE | |
| 131 }; | |
| 132 MostVisitedSource mv_source_; | |
| 133 | |
| 134 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 135 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 138 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
| OLD | NEW |