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 void OnHistoryChanged(); | |
185 | |
186 // Override HistoryServiceObserver. | |
187 virtual void OnURLVisited(HistoryService* history_service, | |
188 ui::PageTransition transition, | |
189 const history::URLRow& row, | |
190 const history::RedirectList& redirects, | |
191 base::Time visit_time) override; | |
192 | |
182 // Override NotificationObserver. | 193 // Override NotificationObserver. |
183 virtual void Observe(int type, | 194 virtual void Observe(int type, |
184 const content::NotificationSource& source, | 195 const content::NotificationSource& source, |
185 const content::NotificationDetails& details) override; | 196 const content::NotificationDetails& details) override; |
186 | 197 |
187 JavaObjectWeakGlobalRef weak_java_provider_; | 198 JavaObjectWeakGlobalRef weak_java_provider_; |
188 | 199 |
189 Profile* profile_; | 200 Profile* profile_; |
brettw
2014/10/14 18:16:57
Can you add a note above this block of profile-rel
sdefresne
2014/10/17 14:32:38
Done.
| |
190 BookmarkModel* bookmark_model_; | 201 BookmarkModel* bookmark_model_; |
202 HistoryService* history_service_; | |
191 history::TopSites* top_sites_; | 203 history::TopSites* top_sites_; |
192 | 204 |
193 scoped_ptr<AndroidHistoryProviderService> service_; | 205 scoped_ptr<AndroidHistoryProviderService> service_; |
194 scoped_ptr<FaviconService> favicon_service_; | 206 scoped_ptr<FaviconService> favicon_service_; |
195 | 207 |
196 base::CancelableTaskTracker cancelable_task_tracker_; | 208 base::CancelableTaskTracker cancelable_task_tracker_; |
197 | 209 |
198 // Used to register/unregister notification observer. | 210 // Used to register/unregister notification observer. |
199 content::NotificationRegistrar notification_registrar_; | 211 content::NotificationRegistrar notification_registrar_; |
200 | 212 |
201 bool handling_extensive_changes_; | 213 bool handling_extensive_changes_; |
202 | 214 |
203 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); | 215 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); |
204 }; | 216 }; |
205 | 217 |
206 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ | 218 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ |
OLD | NEW |