| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROVIDER_CHROME_BROWSER_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ | 6 #define CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 13 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 14 #include "components/history/core/android/android_history_types.h" | 14 #include "components/history/core/android/android_history_types.h" |
| 15 #include "components/history/core/browser/history_service_observer.h" |
| 15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 17 | 18 |
| 18 class AndroidHistoryProviderService; | 19 class AndroidHistoryProviderService; |
| 19 class FaviconService; | 20 class FaviconService; |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 namespace history { | 23 namespace history { |
| 23 class TopSites; | 24 class TopSites; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace sql { | 27 namespace sql { |
| 27 class Statement; | 28 class Statement; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // This class implements the native methods of ChromeBrowserProvider.java | 31 // This class implements the native methods of ChromeBrowserProvider.java |
| 31 class ChromeBrowserProvider : public BaseBookmarkModelObserver, | 32 class ChromeBrowserProvider : public BaseBookmarkModelObserver, |
| 32 public content::NotificationObserver { | 33 public content::NotificationObserver, |
| 34 public history::HistoryServiceObserver { |
| 33 public: | 35 public: |
| 34 ChromeBrowserProvider(JNIEnv* env, jobject obj); | 36 ChromeBrowserProvider(JNIEnv* env, jobject obj); |
| 35 void Destroy(JNIEnv*, jobject); | 37 void Destroy(JNIEnv*, jobject); |
| 36 | 38 |
| 37 // JNI registration. | 39 // JNI registration. |
| 38 static bool RegisterChromeBrowserProvider(JNIEnv* env); | 40 static bool RegisterChromeBrowserProvider(JNIEnv* env); |
| 39 | 41 |
| 40 // Adds either a new bookmark or bookmark folder based on |is_folder|. The | 42 // Adds either a new bookmark or bookmark folder based on |is_folder|. The |
| 41 // bookmark is added to the beginning of the specified parent and if the | 43 // bookmark is added to the beginning of the specified parent and if the |
| 42 // parent ID is not valid (i.e. < 0) then it will be added to the bookmark | 44 // parent ID is not valid (i.e. < 0) then it will be added to the bookmark |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 jstring url); | 174 jstring url); |
| 173 | 175 |
| 174 private: | 176 private: |
| 175 virtual ~ChromeBrowserProvider(); | 177 virtual ~ChromeBrowserProvider(); |
| 176 | 178 |
| 177 // Override BaseBookmarkModelObserver. | 179 // Override BaseBookmarkModelObserver. |
| 178 virtual void BookmarkModelChanged() override; | 180 virtual void BookmarkModelChanged() override; |
| 179 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; | 181 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; |
| 180 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; | 182 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; |
| 181 | 183 |
| 184 // Override HistoryServiceObserver. |
| 185 virtual void OnURLVisited(HistoryService* history_service, |
| 186 ui::PageTransition transition, |
| 187 const history::URLRow& row, |
| 188 const history::RedirectList& redirects, |
| 189 base::Time visit_time) override; |
| 190 |
| 182 // Override NotificationObserver. | 191 // Override NotificationObserver. |
| 183 virtual void Observe(int type, | 192 virtual void Observe(int type, |
| 184 const content::NotificationSource& source, | 193 const content::NotificationSource& source, |
| 185 const content::NotificationDetails& details) override; | 194 const content::NotificationDetails& details) override; |
| 186 | 195 |
| 187 JavaObjectWeakGlobalRef weak_java_provider_; | 196 JavaObjectWeakGlobalRef weak_java_provider_; |
| 188 | 197 |
| 189 Profile* profile_; | 198 Profile* profile_; |
| 190 BookmarkModel* bookmark_model_; | 199 BookmarkModel* bookmark_model_; |
| 200 HistoryService* history_service_; |
| 191 history::TopSites* top_sites_; | 201 history::TopSites* top_sites_; |
| 192 | 202 |
| 193 scoped_ptr<AndroidHistoryProviderService> service_; | 203 scoped_ptr<AndroidHistoryProviderService> service_; |
| 194 scoped_ptr<FaviconService> favicon_service_; | 204 scoped_ptr<FaviconService> favicon_service_; |
| 195 | 205 |
| 196 base::CancelableTaskTracker cancelable_task_tracker_; | 206 base::CancelableTaskTracker cancelable_task_tracker_; |
| 197 | 207 |
| 198 // Used to register/unregister notification observer. | 208 // Used to register/unregister notification observer. |
| 199 content::NotificationRegistrar notification_registrar_; | 209 content::NotificationRegistrar notification_registrar_; |
| 200 | 210 |
| 201 bool handling_extensive_changes_; | 211 bool handling_extensive_changes_; |
| 202 | 212 |
| 203 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); | 213 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); |
| 204 }; | 214 }; |
| 205 | 215 |
| 206 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ | 216 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ |
| OLD | NEW |