| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 const BookmarkNode* folder) const { | 484 const BookmarkNode* folder) const { |
| 485 // The managed bookmarks folder is not shown if there are no bookmarks | 485 // The managed bookmarks folder is not shown if there are no bookmarks |
| 486 // configured via policy. | 486 // configured via policy. |
| 487 if (folder == client_->managed_node() && folder->empty()) | 487 if (folder == client_->managed_node() && folder->empty()) |
| 488 return false; | 488 return false; |
| 489 | 489 |
| 490 SigninManager* signin = SigninManagerFactory::GetForProfile( | 490 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 491 profile_->GetOriginalProfile()); | 491 profile_->GetOriginalProfile()); |
| 492 return (folder->type() != BookmarkNode::BOOKMARK_BAR && | 492 return (folder->type() != BookmarkNode::BOOKMARK_BAR && |
| 493 folder->type() != BookmarkNode::OTHER_NODE) || | 493 folder->type() != BookmarkNode::OTHER_NODE) || |
| 494 (signin && !signin->GetAuthenticatedUsername().empty()); | 494 (signin && signin->IsAuthenticated()); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void BookmarksBridge::NotifyIfDoneLoading() { | 497 void BookmarksBridge::NotifyIfDoneLoading() { |
| 498 if (!IsLoaded()) | 498 if (!IsLoaded()) |
| 499 return; | 499 return; |
| 500 JNIEnv* env = AttachCurrentThread(); | 500 JNIEnv* env = AttachCurrentThread(); |
| 501 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 501 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
| 502 if (obj.is_null()) | 502 if (obj.is_null()) |
| 503 return; | 503 return; |
| 504 Java_BookmarksBridge_bookmarkModelLoaded(env, obj.obj()); | 504 Java_BookmarksBridge_bookmarkModelLoaded(env, obj.obj()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 BookmarkModelChanged(); | 652 BookmarkModelChanged(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 655 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 656 NotifyIfDoneLoading(); | 656 NotifyIfDoneLoading(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 659 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 660 partner_bookmarks_shim_ = NULL; | 660 partner_bookmarks_shim_ = NULL; |
| 661 } | 661 } |
| OLD | NEW |