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.
5 #include "chrome/browser/android/bookmarks/edit_bookmark_helper.h"
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"
15 using bookmarks::BookmarkNode
;
17 void SetPartnerBookmarkTitle(JNIEnv
* env
,
18 const JavaParamRef
<jclass
>& clazz
,
19 const JavaParamRef
<jobject
>& jprofile
,
21 const JavaParamRef
<jstring
>& new_title
) {
22 PartnerBookmarksShim
* partner_bookmarks_shim
=
23 PartnerBookmarksShim::BuildForBrowserContext(
24 chrome::GetBrowserContextRedirectedInIncognito(
25 ProfileAndroid::FromProfileAndroid(jprofile
)));
26 if (!partner_bookmarks_shim
)
29 const BookmarkNode
* node
= partner_bookmarks_shim
->GetNodeByID(bookmark_id
);
33 partner_bookmarks_shim
->RenameBookmark(
35 base::android::ConvertJavaStringToUTF16(env
, new_title
));
39 bool RegisterEditBookmarkHelper(JNIEnv
* env
) {
40 return RegisterNativesImpl(env
);