| 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/bookmark_bridge.h" | 5 #include "chrome/browser/android/bookmarks/bookmark_bridge.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 BookmarkBridge::BookmarkBridge(JNIEnv* env, jobject obj, jobject j_profile) | 96 BookmarkBridge::BookmarkBridge(JNIEnv* env, jobject obj, jobject j_profile) |
| 97 : weak_java_ref_(env, obj), | 97 : weak_java_ref_(env, obj), |
| 98 bookmark_model_(NULL), | 98 bookmark_model_(NULL), |
| 99 managed_bookmark_service_(NULL), | 99 managed_bookmark_service_(NULL), |
| 100 partner_bookmarks_shim_(NULL) { | 100 partner_bookmarks_shim_(NULL) { |
| 101 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 101 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 102 profile_ = ProfileAndroid::FromProfileAndroid(j_profile); | 102 profile_ = ProfileAndroid::FromProfileAndroid(j_profile); |
| 103 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); | 103 bookmark_model_ = BookmarkModelFactory::GetForBrowserContext(profile_); |
| 104 managed_bookmark_service_ = | 104 managed_bookmark_service_ = |
| 105 ManagedBookmarkServiceFactory::GetForProfile(profile_); | 105 ManagedBookmarkServiceFactory::GetForProfile(profile_); |
| 106 | 106 |
| 107 // Registers the notifications we are interested. | 107 // Registers the notifications we are interested. |
| 108 bookmark_model_->AddObserver(this); | 108 bookmark_model_->AddObserver(this); |
| 109 | 109 |
| 110 // Create the partner Bookmarks shim as early as possible (but don't attach). | 110 // Create the partner Bookmarks shim as early as possible (but don't attach). |
| 111 partner_bookmarks_shim_ = PartnerBookmarksShim::BuildForBrowserContext( | 111 partner_bookmarks_shim_ = PartnerBookmarksShim::BuildForBrowserContext( |
| 112 chrome::GetBrowserContextRedirectedInIncognito(profile_)); | 112 chrome::GetBrowserContextRedirectedInIncognito(profile_)); |
| 113 partner_bookmarks_shim_->AddObserver(this); | 113 partner_bookmarks_shim_->AddObserver(this); |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 BookmarkModelChanged(); | 1108 BookmarkModelChanged(); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 void BookmarkBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 1111 void BookmarkBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
| 1112 NotifyIfDoneLoading(); | 1112 NotifyIfDoneLoading(); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 void BookmarkBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 1115 void BookmarkBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
| 1116 partner_bookmarks_shim_ = NULL; | 1116 partner_bookmarks_shim_ = NULL; |
| 1117 } | 1117 } |
| OLD | NEW |