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

Side by Side Diff: chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc

Issue 1143153010: [Android] Add enhanced bookmarks grid/list view experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn fix Created 5 years, 6 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
« no previous file with comments | « chrome/browser/bookmarks/enhanced_bookmarks_features.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h" 5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h"
6 6
7 #include "base/android/jni_array.h" 7 #include "base/android/jni_array.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.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/enhanced_bookmarks/android/bookmark_image_service_andro id.h" 11 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_andro id.h"
12 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_facto ry.h" 12 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_facto ry.h"
13 #include "chrome/browser/enhanced_bookmarks/bookmark_server_cluster_service_fact ory.h" 13 #include "chrome/browser/enhanced_bookmarks/bookmark_server_cluster_service_fact ory.h"
14 #include "chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h" 14 #include "chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h"
15 #include "chrome/browser/profiles/profile_android.h" 15 #include "chrome/browser/profiles/profile_android.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/common/chrome_version_info.h" 18 #include "chrome/common/chrome_version_info.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 20 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_utils.h" 21 #include "components/bookmarks/browser/bookmark_utils.h"
22 #include "components/bookmarks/common/android/bookmark_id.h" 22 #include "components/bookmarks/common/android/bookmark_id.h"
23 #include "components/bookmarks/common/android/bookmark_type.h" 23 #include "components/bookmarks/common/android/bookmark_type.h"
24 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" 24 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h"
25 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" 25 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h"
26 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
26 #include "components/enhanced_bookmarks/image_record.h" 27 #include "components/enhanced_bookmarks/image_record.h"
27 #include "components/signin/core/browser/signin_manager.h" 28 #include "components/signin/core/browser/signin_manager.h"
28 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "jni/EnhancedBookmarksBridge_jni.h" 31 #include "jni/EnhancedBookmarksBridge_jni.h"
31 #include "ui/gfx/android/java_bitmap.h" 32 #include "ui/gfx/android/java_bitmap.h"
32 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
33 34
34 using base::android::AttachCurrentThread; 35 using base::android::AttachCurrentThread;
35 using base::android::ScopedJavaGlobalRef; 36 using base::android::ScopedJavaGlobalRef;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 307
307 bool EnhancedBookmarksBridge::IsEditable(const BookmarkNode* node) const { 308 bool EnhancedBookmarksBridge::IsEditable(const BookmarkNode* node) const {
308 if (!node || (node->type() != BookmarkNode::FOLDER && 309 if (!node || (node->type() != BookmarkNode::FOLDER &&
309 node->type() != BookmarkNode::URL)) { 310 node->type() != BookmarkNode::URL)) {
310 return false; 311 return false;
311 } 312 }
312 return profile_->GetPrefs()->GetBoolean( 313 return profile_->GetPrefs()->GetBoolean(
313 bookmarks::prefs::kEditBookmarksEnabled); 314 bookmarks::prefs::kEditBookmarksEnabled);
314 } 315 }
315 316
317 static jint GetDefaultViewMode(JNIEnv* env, jclass jcaller) {
318 return enhanced_bookmarks::GetDefaultViewMode();
319 }
320
316 static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) { 321 static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) {
317 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( 322 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge(
318 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); 323 env, obj, ProfileAndroid::FromProfileAndroid(j_profile)));
319 } 324 }
320 325
321 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) { 326 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) {
322 return RegisterNativesImpl(env); 327 return RegisterNativesImpl(env);
323 } 328 }
324 329
325 } // namespace android 330 } // namespace android
326 } // namespace enhanced_bookmarks 331 } // namespace enhanced_bookmarks
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/enhanced_bookmarks_features.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698