Chromium Code Reviews| 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 MostVisitedSource mv_source_; | |
|
Bernhard Bauer
2014/09/30 13:04:16
Sorry, this should stay in its original place. Acc
| |
| 65 | |
| 59 virtual ~MostVisitedSites(); | 66 virtual ~MostVisitedSites(); |
| 60 void QueryMostVisitedURLs(); | 67 void QueryMostVisitedURLs(); |
| 61 | 68 |
| 62 // Initialize the query to Top Sites. Called if the SuggestionsService is not | 69 // Initialize the query to Top Sites. Called if the SuggestionsService is not |
| 63 // enabled, or if it returns no data. | 70 // enabled, or if it returns no data. |
| 64 void InitiateTopSitesQuery(); | 71 void InitiateTopSitesQuery(); |
| 65 | 72 |
| 66 // Callback for when data is available from TopSites. | 73 // Callback for when data is available from TopSites. |
| 67 void OnMostVisitedURLsAvailable( | 74 void OnMostVisitedURLsAvailable( |
| 68 base::android::ScopedJavaGlobalRef<jobject>* j_observer, | 75 base::android::ScopedJavaGlobalRef<jobject>* j_observer, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 int num_local_thumbs_; | 119 int num_local_thumbs_; |
| 113 // Number of tiles for which a server thumbnail is provided. | 120 // Number of tiles for which a server thumbnail is provided. |
| 114 int num_server_thumbs_; | 121 int num_server_thumbs_; |
| 115 // Number of tiles for which no thumbnail is found/specified and a gray tile | 122 // Number of tiles for which no thumbnail is found/specified and a gray tile |
| 116 // is used as the main tile. | 123 // is used as the main tile. |
| 117 int num_empty_thumbs_; | 124 int num_empty_thumbs_; |
| 118 | 125 |
| 119 // Copy of the server suggestions (if enabled). Used for logging. | 126 // Copy of the server suggestions (if enabled). Used for logging. |
| 120 suggestions::SuggestionsProfile server_suggestions_; | 127 suggestions::SuggestionsProfile server_suggestions_; |
| 121 | 128 |
| 129 content::NotificationRegistrar registrar_; | |
| 130 | |
| 122 // For callbacks may be run after destruction. | 131 // For callbacks may be run after destruction. |
| 123 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 132 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 124 | 133 |
| 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); | 134 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 137 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
| OLD | NEW |