Chromium Code Reviews| 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 #include "chrome/browser/android/bookmarks/bookmarks_bridge.h" | 5 #include "chrome/browser/android/bookmarks/bookmarks_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/containers/stack_container.h" | 8 #include "base/containers/stack_container.h" |
| 9 #include "base/i18n/string_compare.h" | 9 #include "base/i18n/string_compare.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 238 |
| 239 for (std::vector<const BookmarkNode*>::const_iterator it = | 239 for (std::vector<const BookmarkNode*>::const_iterator it = |
| 240 top_level_folders.begin(); it != top_level_folders.end(); ++it) { | 240 top_level_folders.begin(); it != top_level_folders.end(); ++it) { |
| 241 Java_BookmarksBridge_addToBookmarkIdList(env, | 241 Java_BookmarksBridge_addToBookmarkIdList(env, |
| 242 j_result_obj, | 242 j_result_obj, |
| 243 (*it)->id(), | 243 (*it)->id(), |
| 244 GetBookmarkType(*it)); | 244 GetBookmarkType(*it)); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void BookmarksBridge::GetUncategorizedBookmarkIDs(JNIEnv* env, | |
| 249 jobject obj, | |
| 250 jobject j_result_obj) { | |
| 251 std::vector<const BookmarkNode*> uncategorized_bookmarks; | |
| 252 | |
| 253 const BookmarkNode* mobile_node = bookmark_model_->mobile_node(); | |
| 254 for (int i = 0; i < mobile_node->child_count(); ++i) { | |
| 255 const BookmarkNode* node = mobile_node->GetChild(i); | |
| 256 if (!node->is_folder()) { | |
| 257 uncategorized_bookmarks.push_back(node); | |
| 258 } | |
| 259 } | |
| 260 | |
| 261 const BookmarkNode* other_node = bookmark_model_->other_node(); | |
| 262 for (int i = 0; i < other_node->child_count(); ++i) { | |
| 263 const BookmarkNode* node = other_node->GetChild(i); | |
| 264 if (!node->is_folder()) { | |
| 265 uncategorized_bookmarks.push_back(node); | |
| 266 } | |
| 267 } | |
| 268 | |
| 269 for (std::vector<const BookmarkNode*>::const_iterator it = | |
| 270 uncategorized_bookmarks.begin(); it != uncategorized_bookmarks.end(); | |
| 271 ++it) { | |
| 272 Java_BookmarksBridge_addToBookmarkIdList(env, | |
|
Ted C
2014/09/03 20:49:06
why not add them in the above loops instead of cre
Kibeom Kim (inactive)
2014/09/03 20:54:24
Done.
| |
| 273 j_result_obj, | |
| 274 (*it)->id(), | |
| 275 GetBookmarkType(*it)); | |
| 276 } | |
| 277 } | |
| 278 | |
| 248 void BookmarksBridge::GetChildIDs(JNIEnv* env, | 279 void BookmarksBridge::GetChildIDs(JNIEnv* env, |
| 249 jobject obj, | 280 jobject obj, |
| 250 jlong id, | 281 jlong id, |
| 251 jint type, | 282 jint type, |
| 252 jboolean get_folders, | 283 jboolean get_folders, |
| 253 jboolean get_bookmarks, | 284 jboolean get_bookmarks, |
| 254 jobject j_result_obj) { | 285 jobject j_result_obj) { |
| 255 DCHECK(IsLoaded()); | 286 DCHECK(IsLoaded()); |
| 256 | 287 |
| 257 const BookmarkNode* parent = GetNodeByID(id, type); | 288 const BookmarkNode* parent = GetNodeByID(id, type); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 753 BookmarkModelChanged(); | 784 BookmarkModelChanged(); |
| 754 } | 785 } |
| 755 | 786 |
| 756 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 787 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 757 NotifyIfDoneLoading(); | 788 NotifyIfDoneLoading(); |
| 758 } | 789 } |
| 759 | 790 |
| 760 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 791 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 761 partner_bookmarks_shim_ = NULL; | 792 partner_bookmarks_shim_ = NULL; |
| 762 } | 793 } |
| OLD | NEW |