| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 | 272 |
| 273 bool BookmarksBridge::IsEditable(const BookmarkNode* node) const { | 273 bool BookmarksBridge::IsEditable(const BookmarkNode* node) const { |
| 274 if (!node || (node->type() != BookmarkNode::FOLDER && | 274 if (!node || (node->type() != BookmarkNode::FOLDER && |
| 275 node->type() != BookmarkNode::URL)) { | 275 node->type() != BookmarkNode::URL)) { |
| 276 return false; | 276 return false; |
| 277 } | 277 } |
| 278 if (!IsEditBookmarksEnabled()) | 278 if (!IsEditBookmarksEnabled()) |
| 279 return false; | 279 return false; |
| 280 if (partner_bookmarks_shim_->IsPartnerBookmark(node)) | 280 if (partner_bookmarks_shim_->IsPartnerBookmark(node)) |
| 281 return true; | 281 return partner_bookmarks_shim_->IsEditable(node); |
| 282 return !managed_bookmarks_shim_->IsManagedBookmark(node); | 282 return !managed_bookmarks_shim_->IsManagedBookmark(node); |
| 283 } | 283 } |
| 284 | 284 |
| 285 const BookmarkNode* BookmarksBridge::GetParentNode(const BookmarkNode* node) { | 285 const BookmarkNode* BookmarksBridge::GetParentNode(const BookmarkNode* node) { |
| 286 DCHECK(IsLoaded()); | 286 DCHECK(IsLoaded()); |
| 287 if (node == managed_bookmarks_shim_->GetManagedBookmarksRoot() || | 287 if (node == managed_bookmarks_shim_->GetManagedBookmarksRoot() || |
| 288 node == partner_bookmarks_shim_->GetPartnerBookmarksRoot()) { | 288 node == partner_bookmarks_shim_->GetPartnerBookmarksRoot()) { |
| 289 return bookmark_model_->mobile_node(); | 289 return bookmark_model_->mobile_node(); |
| 290 } else { | 290 } else { |
| 291 return node->parent(); | 291 return node->parent(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 BookmarkModelChanged(); | 490 BookmarkModelChanged(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 493 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 494 NotifyIfDoneLoading(); | 494 NotifyIfDoneLoading(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 497 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 498 partner_bookmarks_shim_ = NULL; | 498 partner_bookmarks_shim_ = NULL; |
| 499 } | 499 } |
| OLD | NEW |