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