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" |
11 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 11 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
12 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | |
12 #include "chrome/browser/profiles/incognito_helpers.h" | 13 #include "chrome/browser/profiles/incognito_helpers.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_android.h" | 15 #include "chrome/browser/profiles/profile_android.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "components/bookmarks/browser/bookmark_model.h" | 19 #include "components/bookmarks/browser/bookmark_model.h" |
19 #include "components/bookmarks/browser/bookmark_utils.h" | 20 #include "components/bookmarks/browser/bookmark_utils.h" |
20 #include "components/bookmarks/common/android/bookmark_type.h" | 21 #include "components/bookmarks/common/android/bookmark_type.h" |
21 #include "components/signin/core/browser/signin_manager.h" | 22 #include "components/signin/core/browser/signin_manager.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 } | 93 } |
93 | 94 |
94 static jlong GetNativeBookmarkModel(JNIEnv* env, | 95 static jlong GetNativeBookmarkModel(JNIEnv* env, |
95 jclass caller, | 96 jclass caller, |
96 jobject j_profile) { | 97 jobject j_profile) { |
97 Profile *profile = ProfileAndroid::FromProfileAndroid(j_profile); | 98 Profile *profile = ProfileAndroid::FromProfileAndroid(j_profile); |
98 BookmarkModel *bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); | 99 BookmarkModel *bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); |
99 return reinterpret_cast<jlong>(bookmark_model_); | 100 return reinterpret_cast<jlong>(bookmark_model_); |
100 } | 101 } |
101 | 102 |
103 static jboolean IsEnhancedBookmarksFeatureEnabled(JNIEnv* env, | |
104 jclass clazz, | |
105 jobject j_profile) { | |
106 Profile *profile = ProfileAndroid::FromProfileAndroid(j_profile); | |
Yaron
2014/09/03 01:11:25
nit: Profile* profile
(I guess this is consistent
Kibeom Kim (inactive)
2014/09/03 06:33:28
Done.
| |
107 return IsEnhancedBookmarksEnabled(profile->GetPrefs()); | |
108 } | |
109 | |
102 static bool IsEditBookmarksEnabled() { | 110 static bool IsEditBookmarksEnabled() { |
103 return ProfileManager::GetLastUsedProfile()->GetPrefs()->GetBoolean( | 111 return ProfileManager::GetLastUsedProfile()->GetPrefs()->GetBoolean( |
104 prefs::kEditBookmarksEnabled); | 112 prefs::kEditBookmarksEnabled); |
105 } | 113 } |
106 | 114 |
107 static jboolean IsEditBookmarksEnabled(JNIEnv* env, jclass clazz) { | 115 static jboolean IsEditBookmarksEnabled(JNIEnv* env, jclass clazz) { |
108 return IsEditBookmarksEnabled(); | 116 return IsEditBookmarksEnabled(); |
109 } | 117 } |
110 | 118 |
111 ScopedJavaLocalRef<jobject> BookmarksBridge::GetBookmarkByID(JNIEnv* env, | 119 ScopedJavaLocalRef<jobject> BookmarksBridge::GetBookmarkByID(JNIEnv* env, |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 BookmarkModelChanged(); | 660 BookmarkModelChanged(); |
653 } | 661 } |
654 | 662 |
655 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { | 663 void BookmarksBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { |
656 NotifyIfDoneLoading(); | 664 NotifyIfDoneLoading(); |
657 } | 665 } |
658 | 666 |
659 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { | 667 void BookmarksBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { |
660 partner_bookmarks_shim_ = NULL; | 668 partner_bookmarks_shim_ = NULL; |
661 } | 669 } |
OLD | NEW |