Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/android/bookmarks/bookmarks_bridge.cc

Issue 598593007: Make EnhancedBookmarkBridge initialized with profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/i18n/string_compare.h" 9 #include "base/i18n/string_compare.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // static 119 // static
120 bool BookmarksBridge::RegisterBookmarksBridge(JNIEnv* env) { 120 bool BookmarksBridge::RegisterBookmarksBridge(JNIEnv* env) {
121 return RegisterNativesImpl(env); 121 return RegisterNativesImpl(env);
122 } 122 }
123 123
124 static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) { 124 static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) {
125 BookmarksBridge* delegate = new BookmarksBridge(env, obj, j_profile); 125 BookmarksBridge* delegate = new BookmarksBridge(env, obj, j_profile);
126 return reinterpret_cast<intptr_t>(delegate); 126 return reinterpret_cast<intptr_t>(delegate);
127 } 127 }
128 128
129 static jlong GetNativeBookmarkModel(JNIEnv* env,
130 jclass caller,
131 jobject j_profile) {
132 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
133 BookmarkModel *bookmark_model_ = BookmarkModelFactory::GetForProfile(profile);
134 return reinterpret_cast<jlong>(bookmark_model_);
135 }
136
137 static jboolean IsEnhancedBookmarksFeatureEnabled(JNIEnv* env, 129 static jboolean IsEnhancedBookmarksFeatureEnabled(JNIEnv* env,
138 jclass clazz, 130 jclass clazz,
139 jobject j_profile) { 131 jobject j_profile) {
140 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); 132 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
141 return IsEnhancedBookmarksEnabled(profile->GetPrefs()); 133 return IsEnhancedBookmarksEnabled(profile->GetPrefs());
142 } 134 }
143 135
144 static bool IsEditBookmarksEnabled() { 136 static bool IsEditBookmarksEnabled() {
145 return ProfileManager::GetLastUsedProfile()->GetPrefs()->GetBoolean( 137 return ProfileManager::GetLastUsedProfile()->GetPrefs()->GetBoolean(
146 bookmarks::prefs::kEditBookmarksEnabled); 138 bookmarks::prefs::kEditBookmarksEnabled);
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 BookmarkModelChanged(); 967 BookmarkModelChanged();
976 } 968 }
977 969
978 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { 970 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) {
979 NotifyIfDoneLoading(); 971 NotifyIfDoneLoading();
980 } 972 }
981 973
982 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { 974 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) {
983 partner_bookmarks_shim_ = NULL; 975 partner_bookmarks_shim_ = NULL;
984 } 976 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698