OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/android/bookmark/edit_bookmark_helper.h" | |
6 | |
7 #include "base/android/jni_android.h" | |
8 #include "base/android/jni_string.h" | |
9 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | |
10 #include "chrome/browser/profiles/incognito_helpers.h" | |
11 #include "chrome/browser/profiles/profile.h" | |
12 #include "chrome/browser/profiles/profile_android.h" | |
13 #include "jni/EditBookmarkHelper_jni.h" | |
14 | |
15 using bookmarks::BookmarkNode; | |
16 | |
17 void SetPartnerBookmarkTitle(JNIEnv* env, | |
18 jclass clazz, | |
19 jobject jprofile, | |
20 jlong bookmark_id, | |
21 jstring new_title) { | |
22 PartnerBookmarksShim* partner_bookmarks_shim = | |
23 PartnerBookmarksShim::BuildForBrowserContext( | |
24 chrome::GetBrowserContextRedirectedInIncognito( | |
25 ProfileAndroid::FromProfileAndroid(jprofile))); | |
26 if (!partner_bookmarks_shim) | |
27 return; | |
28 | |
29 const BookmarkNode* node = partner_bookmarks_shim->GetNodeByID(bookmark_id); | |
30 if (!node) | |
31 return; | |
32 | |
33 partner_bookmarks_shim->RenameBookmark( | |
34 node, | |
35 base::android::ConvertJavaStringToUTF16(env, new_title)); | |
36 } | |
37 | |
38 // static | |
39 bool RegisterEditBookmarkHelper(JNIEnv* env) { | |
40 return RegisterNativesImpl(env); | |
41 } | |
OLD | NEW |