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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace history { | 24 namespace history { |
25 class TopSites; | 25 class TopSites; |
26 } | 26 } |
27 | 27 |
28 namespace sql { | 28 namespace sql { |
29 class Statement; | 29 class Statement; |
30 } | 30 } |
31 | 31 |
32 // This class implements the native methods of ChromeBrowserProvider.java | 32 // This class implements the native methods of ChromeBrowserProvider.java |
33 class ChromeBrowserProvider : public BaseBookmarkModelObserver, | 33 class ChromeBrowserProvider : public bookmarks::BaseBookmarkModelObserver, |
34 public content::NotificationObserver, | 34 public content::NotificationObserver, |
35 public history::HistoryServiceObserver { | 35 public history::HistoryServiceObserver { |
36 public: | 36 public: |
37 ChromeBrowserProvider(JNIEnv* env, jobject obj); | 37 ChromeBrowserProvider(JNIEnv* env, jobject obj); |
38 void Destroy(JNIEnv*, jobject); | 38 void Destroy(JNIEnv*, jobject); |
39 | 39 |
40 // JNI registration. | 40 // JNI registration. |
41 static bool RegisterChromeBrowserProvider(JNIEnv* env); | 41 static bool RegisterChromeBrowserProvider(JNIEnv* env); |
42 | 42 |
43 // Adds either a new bookmark or bookmark folder based on |is_folder|. The | 43 // Adds either a new bookmark or bookmark folder based on |is_folder|. The |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 jobject obj, | 170 jobject obj, |
171 jstring url); | 171 jstring url); |
172 | 172 |
173 base::android::ScopedJavaLocalRef<jbyteArray> GetThumbnail(JNIEnv* env, | 173 base::android::ScopedJavaLocalRef<jbyteArray> GetThumbnail(JNIEnv* env, |
174 jobject obj, | 174 jobject obj, |
175 jstring url); | 175 jstring url); |
176 | 176 |
177 private: | 177 private: |
178 virtual ~ChromeBrowserProvider(); | 178 virtual ~ChromeBrowserProvider(); |
179 | 179 |
180 // Override BaseBookmarkModelObserver. | 180 // Override bookmarks::BaseBookmarkModelObserver. |
181 virtual void BookmarkModelChanged() override; | 181 virtual void BookmarkModelChanged() override; |
182 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; | 182 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; |
183 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; | 183 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; |
184 | 184 |
185 // Deals with updates to the history service. | 185 // Deals with updates to the history service. |
186 void OnHistoryChanged(); | 186 void OnHistoryChanged(); |
187 | 187 |
188 // Override HistoryServiceObserver. | 188 // Override history::HistoryServiceObserver. |
189 virtual void OnURLVisited(HistoryService* history_service, | 189 virtual void OnURLVisited(HistoryService* history_service, |
190 ui::PageTransition transition, | 190 ui::PageTransition transition, |
191 const history::URLRow& row, | 191 const history::URLRow& row, |
192 const history::RedirectList& redirects, | 192 const history::RedirectList& redirects, |
193 base::Time visit_time) override; | 193 base::Time visit_time) override; |
194 | 194 |
195 // Override NotificationObserver. | 195 // Override content::NotificationObserver. |
196 virtual void Observe(int type, | 196 virtual void Observe(int type, |
197 const content::NotificationSource& source, | 197 const content::NotificationSource& source, |
198 const content::NotificationDetails& details) override; | 198 const content::NotificationDetails& details) override; |
199 | 199 |
200 JavaObjectWeakGlobalRef weak_java_provider_; | 200 JavaObjectWeakGlobalRef weak_java_provider_; |
201 | 201 |
202 // Profile must outlive this object. | 202 // Profile must outlive this object. |
203 // | 203 // |
204 // BookmarkModel, HistoryService and history::TopSites lifetime is bound to | 204 // BookmarkModel, HistoryService and history::TopSites lifetime is bound to |
205 // the lifetime of Profile, they are safe to use as long as the Profile is | 205 // the lifetime of Profile, they are safe to use as long as the Profile is |
(...skipping 10 matching lines...) Expand all Loading... |
216 content::NotificationRegistrar notification_registrar_; | 216 content::NotificationRegistrar notification_registrar_; |
217 ScopedObserver<HistoryService, HistoryServiceObserver> | 217 ScopedObserver<HistoryService, HistoryServiceObserver> |
218 history_service_observer_; | 218 history_service_observer_; |
219 | 219 |
220 bool handling_extensive_changes_; | 220 bool handling_extensive_changes_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); | 222 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProvider); |
223 }; | 223 }; |
224 | 224 |
225 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ | 225 #endif // CHROME_BROWSER_ANDROID_PROVIDER_CHROME_BROWSER_PROVIDER_H_ |
OLD | NEW |