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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 it = permanent_nodes->begin(); | 137 it = permanent_nodes->begin(); |
| 138 it != permanent_nodes->end(); | 138 it != permanent_nodes->end(); |
| 139 ++it) { | 139 ++it) { |
| 140 if (*it != NULL) { | 140 if (*it != NULL) { |
| 141 Java_BookmarksBridge_addToBookmarkIdList( | 141 Java_BookmarksBridge_addToBookmarkIdList( |
| 142 env, j_result_obj, (*it)->id(), GetBookmarkType(*it)); | 142 env, j_result_obj, (*it)->id(), GetBookmarkType(*it)); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void BookmarksBridge::GetEditablePermanentIDs(JNIEnv* env, | |
|
Ted C
2014/08/28 18:46:21
Editable is an overloaded term in this file. We h
Ian Wen
2014/08/28 21:18:05
This function is the first step to show folder hie
| |
| 148 jobject obj, | |
| 149 jobject j_result_obj) { | |
| 150 DCHECK(IsLoaded()); | |
| 151 | |
| 152 base::StackVector<const BookmarkNode*, 8> permanent_nodes; | |
| 153 | |
| 154 const BookmarkNode* root_node = bookmark_model_->root_node(); | |
| 155 for (int i = 0; i < root_node->child_count(); ++i) { | |
| 156 permanent_nodes->push_back(root_node->GetChild(i)); | |
| 157 } | |
| 158 | |
| 159 for (base::StackVector<const BookmarkNode*, 8>::ContainerType::const_iterator | |
| 160 it = permanent_nodes->begin(); | |
| 161 it != permanent_nodes->end(); | |
| 162 ++it) { | |
| 163 if (*it != NULL && client_->CanBeEditedByUser((*it))) { | |
|
newt (away)
2014/08/28 18:51:38
suggestion: check client_->CanBeEditedByUser(*it)
Ian Wen
2014/08/28 21:18:05
Done.
| |
| 164 Java_BookmarksBridge_addToBookmarkIdList( | |
| 165 env, j_result_obj, (*it)->id(), GetBookmarkType(*it)); | |
| 166 } | |
| 167 } | |
| 168 } | |
| 169 | |
| 147 void BookmarksBridge::GetChildIDs(JNIEnv* env, | 170 void BookmarksBridge::GetChildIDs(JNIEnv* env, |
| 148 jobject obj, | 171 jobject obj, |
| 149 jlong id, | 172 jlong id, |
| 150 jint type, | 173 jint type, |
| 151 jboolean get_folders, | 174 jboolean get_folders, |
| 152 jboolean get_bookmarks, | 175 jboolean get_bookmarks, |
| 153 jobject j_result_obj) { | 176 jobject j_result_obj) { |
| 154 DCHECK(IsLoaded()); | 177 DCHECK(IsLoaded()); |
| 155 | 178 |
| 156 const BookmarkNode* parent = GetNodeByID(id, type); | 179 const BookmarkNode* parent = GetNodeByID(id, type); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 BookmarkModelChanged(); | 675 BookmarkModelChanged(); |
| 653 } | 676 } |
| 654 | 677 |
| 655 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 678 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 656 NotifyIfDoneLoading(); | 679 NotifyIfDoneLoading(); |
| 657 } | 680 } |
| 658 | 681 |
| 659 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 682 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 660 partner_bookmarks_shim_ = NULL; | 683 partner_bookmarks_shim_ = NULL; |
| 661 } | 684 } |
| OLD | NEW |