| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 Java_BookmarksBridge_addToList( | 389 Java_BookmarksBridge_addToList( |
| 390 env, j_result_obj, CreateJavaBookmark(node).obj()); | 390 env, j_result_obj, CreateJavaBookmark(node).obj()); |
| 391 } | 391 } |
| 392 | 392 |
| 393 const BookmarkNode* BookmarksBridge::GetNodeByID(long node_id, int type) { | 393 const BookmarkNode* BookmarksBridge::GetNodeByID(long node_id, int type) { |
| 394 const BookmarkNode* node; | 394 const BookmarkNode* node; |
| 395 if (type == kBookmarkTypePartner) { | 395 if (type == kBookmarkTypePartner) { |
| 396 node = partner_bookmarks_shim_->GetNodeByID( | 396 node = partner_bookmarks_shim_->GetNodeByID( |
| 397 static_cast<int64>(node_id)); | 397 static_cast<int64>(node_id)); |
| 398 } else { | 398 } else { |
| 399 node = GetBookmarkNodeByID(bookmark_model_, static_cast<int64>(node_id)); | 399 node = bookmarks::GetBookmarkNodeByID(bookmark_model_, |
| 400 static_cast<int64>(node_id)); |
| 400 } | 401 } |
| 401 return node; | 402 return node; |
| 402 } | 403 } |
| 403 | 404 |
| 404 const BookmarkNode* BookmarksBridge::GetFolderWithFallback(long folder_id, | 405 const BookmarkNode* BookmarksBridge::GetFolderWithFallback(long folder_id, |
| 405 int type) { | 406 int type) { |
| 406 const BookmarkNode* folder = GetNodeByID(folder_id, type); | 407 const BookmarkNode* folder = GetNodeByID(folder_id, type); |
| 407 if (!folder || folder->type() == BookmarkNode::URL || | 408 if (!folder || folder->type() == BookmarkNode::URL || |
| 408 !IsFolderAvailable(folder)) { | 409 !IsFolderAvailable(folder)) { |
| 409 if (!client_->managed_node()->empty()) | 410 if (!client_->managed_node()->empty()) |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 BookmarkModelChanged(); | 635 BookmarkModelChanged(); |
| 635 } | 636 } |
| 636 | 637 |
| 637 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 638 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 638 NotifyIfDoneLoading(); | 639 NotifyIfDoneLoading(); |
| 639 } | 640 } |
| 640 | 641 |
| 641 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 642 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 642 partner_bookmarks_shim_ = NULL; | 643 partner_bookmarks_shim_ = NULL; |
| 643 } | 644 } |
| OLD | NEW |