| 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_BOOKMARKS_BOOKMARKS_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BOOKMARKS_BOOKMARKS_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BOOKMARKS_BOOKMARKS_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_BOOKMARKS_BOOKMARKS_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 14 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
| 15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 16 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 16 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 17 #include "components/bookmarks/common/android/bookmark_id.h" | 17 #include "components/bookmarks/common/android/bookmark_id.h" |
| 18 | 18 |
| 19 namespace bookmarks { | 19 namespace bookmarks { |
| 20 class ScopedGroupBookmarkActions; | 20 class ScopedGroupBookmarkActions; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class Profile; | 23 class Profile; |
| 24 | 24 |
| 25 // The delegate to fetch bookmarks information for the Android native | 25 // The delegate to fetch bookmarks information for the Android native |
| 26 // bookmark page. This fetches the bookmarks, title, urls, folder | 26 // bookmark page. This fetches the bookmarks, title, urls, folder |
| 27 // hierarchy. | 27 // hierarchy. |
| 28 class BookmarksBridge : public BaseBookmarkModelObserver, | 28 class BookmarksBridge : public bookmarks::BaseBookmarkModelObserver, |
| 29 public PartnerBookmarksShim::Observer { | 29 public PartnerBookmarksShim::Observer { |
| 30 public: | 30 public: |
| 31 BookmarksBridge(JNIEnv* env, jobject obj, jobject j_profile); | 31 BookmarksBridge(JNIEnv* env, jobject obj, jobject j_profile); |
| 32 void Destroy(JNIEnv*, jobject); | 32 void Destroy(JNIEnv*, jobject); |
| 33 | 33 |
| 34 static bool RegisterBookmarksBridge(JNIEnv* env); | 34 static bool RegisterBookmarksBridge(JNIEnv* env); |
| 35 | 35 |
| 36 bool IsDoingExtensiveChanges(JNIEnv* env, jobject obj); | 36 bool IsDoingExtensiveChanges(JNIEnv* env, jobject obj); |
| 37 | 37 |
| 38 void LoadEmptyPartnerBookmarkShimForTesting(JNIEnv* env, jobject obj); | 38 void LoadEmptyPartnerBookmarkShimForTesting(JNIEnv* env, jobject obj); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool IsEditable(const BookmarkNode* node) const; | 168 bool IsEditable(const BookmarkNode* node) const; |
| 169 // Returns whether |node| is a managed bookmark. | 169 // Returns whether |node| is a managed bookmark. |
| 170 bool IsManaged(const BookmarkNode* node) const; | 170 bool IsManaged(const BookmarkNode* node) const; |
| 171 const BookmarkNode* GetParentNode(const BookmarkNode* node); | 171 const BookmarkNode* GetParentNode(const BookmarkNode* node); |
| 172 int GetBookmarkType(const BookmarkNode* node); | 172 int GetBookmarkType(const BookmarkNode* node); |
| 173 bool IsReachable(const BookmarkNode* node) const; | 173 bool IsReachable(const BookmarkNode* node) const; |
| 174 bool IsLoaded() const; | 174 bool IsLoaded() const; |
| 175 bool IsFolderAvailable(const BookmarkNode* folder) const; | 175 bool IsFolderAvailable(const BookmarkNode* folder) const; |
| 176 void NotifyIfDoneLoading(); | 176 void NotifyIfDoneLoading(); |
| 177 | 177 |
| 178 // Override BaseBookmarkModelObserver. | 178 // Override bookmarks::BaseBookmarkModelObserver. |
| 179 // Called when there are changes to the bookmark model that don't trigger | 179 // Called when there are changes to the bookmark model that don't trigger |
| 180 // any of the other callback methods. For example, this is called when | 180 // any of the other callback methods. For example, this is called when |
| 181 // partner bookmarks change. | 181 // partner bookmarks change. |
| 182 virtual void BookmarkModelChanged() override; | 182 virtual void BookmarkModelChanged() override; |
| 183 virtual void BookmarkModelLoaded(BookmarkModel* model, | 183 virtual void BookmarkModelLoaded(BookmarkModel* model, |
| 184 bool ids_reassigned) override; | 184 bool ids_reassigned) override; |
| 185 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; | 185 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; |
| 186 virtual void BookmarkNodeMoved(BookmarkModel* model, | 186 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 187 const BookmarkNode* old_parent, | 187 const BookmarkNode* old_parent, |
| 188 int old_index, | 188 int old_index, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 215 scoped_ptr<bookmarks::ScopedGroupBookmarkActions> grouped_bookmark_actions_; | 215 scoped_ptr<bookmarks::ScopedGroupBookmarkActions> grouped_bookmark_actions_; |
| 216 | 216 |
| 217 // Information about the Partner bookmarks (must check for IsLoaded()). | 217 // Information about the Partner bookmarks (must check for IsLoaded()). |
| 218 // This is owned by profile. | 218 // This is owned by profile. |
| 219 PartnerBookmarksShim* partner_bookmarks_shim_; | 219 PartnerBookmarksShim* partner_bookmarks_shim_; |
| 220 | 220 |
| 221 DISALLOW_COPY_AND_ASSIGN(BookmarksBridge); | 221 DISALLOW_COPY_AND_ASSIGN(BookmarksBridge); |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 #endif // CHROME_BROWSER_ANDROID_BOOKMARKS_BOOKMARKS_BRIDGE_H_ | 224 #endif // CHROME_BROWSER_ANDROID_BOOKMARKS_BOOKMARKS_BRIDGE_H_ |
| OLD | NEW |