Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h" | 5 #include "chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_servi ce.h" | 10 #include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_servi ce.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 cluster_service_->RemoveObserver(this); | 36 cluster_service_->RemoveObserver(this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void EnhancedBookmarksBridge::Destroy(JNIEnv*, jobject) { | 39 void EnhancedBookmarksBridge::Destroy(JNIEnv*, jobject) { |
| 40 delete this; | 40 delete this; |
| 41 } | 41 } |
| 42 | 42 |
| 43 ScopedJavaLocalRef<jstring> EnhancedBookmarksBridge::GetBookmarkDescription( | 43 ScopedJavaLocalRef<jstring> EnhancedBookmarksBridge::GetBookmarkDescription( |
| 44 JNIEnv* env, jobject obj, jlong id, jint type) { | 44 JNIEnv* env, jobject obj, jlong id, jint type) { |
| 45 DCHECK(bookmark_model_->loaded()); | 45 DCHECK(bookmark_model_->loaded()); |
| 46 DCHECK_EQ(type, BookmarkType::NORMAL); | 46 DCHECK_EQ(type, BookmarkType::BOOKMARK_TYPE_NORMAL); |
|
Lei Zhang
2014/10/14 22:52:40
If you don't mind, flip this around because it's D
mkosiba (inactive)
2014/10/16 12:45:07
Done.
| |
| 47 | 47 |
| 48 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( | 48 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( |
| 49 bookmark_model_, static_cast<int64>(id)); | 49 bookmark_model_, static_cast<int64>(id)); |
| 50 | 50 |
| 51 return node ? | 51 return node ? |
| 52 base::android::ConvertUTF8ToJavaString( | 52 base::android::ConvertUTF8ToJavaString( |
| 53 env, enhanced_bookmarks::DescriptionFromBookmark(node)) : | 53 env, enhanced_bookmarks::DescriptionFromBookmark(node)) : |
| 54 ScopedJavaLocalRef<jstring>(); | 54 ScopedJavaLocalRef<jstring>(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void EnhancedBookmarksBridge::SetBookmarkDescription(JNIEnv* env, | 57 void EnhancedBookmarksBridge::SetBookmarkDescription(JNIEnv* env, |
| 58 jobject obj, | 58 jobject obj, |
| 59 jlong id, | 59 jlong id, |
| 60 jint type, | 60 jint type, |
| 61 jstring description) { | 61 jstring description) { |
| 62 DCHECK(bookmark_model_->loaded()); | 62 DCHECK(bookmark_model_->loaded()); |
| 63 DCHECK_EQ(type, BookmarkType::NORMAL); | 63 DCHECK_EQ(type, BookmarkType::BOOKMARK_TYPE_NORMAL); |
| 64 | 64 |
| 65 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( | 65 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( |
| 66 bookmark_model_, static_cast<int64>(id)); | 66 bookmark_model_, static_cast<int64>(id)); |
| 67 | 67 |
| 68 enhanced_bookmarks::SetDescriptionForBookmark( | 68 enhanced_bookmarks::SetDescriptionForBookmark( |
| 69 bookmark_model_, node, | 69 bookmark_model_, node, |
| 70 base::android::ConvertJavaStringToUTF8(env, description)); | 70 base::android::ConvertJavaStringToUTF8(env, description)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void EnhancedBookmarksBridge::GetBookmarksForFilter(JNIEnv* env, | 73 void EnhancedBookmarksBridge::GetBookmarksForFilter(JNIEnv* env, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( | 109 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( |
| 110 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); | 110 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) { | 113 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) { |
| 114 return RegisterNativesImpl(env); | 114 return RegisterNativesImpl(env); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace android | 117 } // namespace android |
| 118 } // namespace enhanced_bookmarks | 118 } // namespace enhanced_bookmarks |
| OLD | NEW |