OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 package org.chromium.chrome.browser.partnerbookmarks; | 5 package org.chromium.chrome.browser.partnerbookmarks; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.AsyncTask; | 8 import android.os.AsyncTask; |
9 import android.util.Log; | 9 import android.util.Log; |
10 | 10 |
11 import java.util.ArrayList; | 11 import java.util.ArrayList; |
12 import java.util.HashSet; | 12 import java.util.HashSet; |
13 import java.util.Iterator; | 13 import java.util.Iterator; |
14 import java.util.LinkedHashMap; | 14 import java.util.LinkedHashMap; |
15 | 15 |
16 /** | 16 /** |
17 * Reads bookmarks from the partner content provider (if any). | 17 * Reads bookmarks from the partner content provider (if any). |
18 */ | 18 */ |
19 public class PartnerBookmarksReader { | 19 public class PartnerBookmarksReader { |
20 private static final String TAG = "PartnerBookmarksReader"; | 20 private static final String TAG = "PartnerBookmarksReader"; |
21 | 21 |
22 private static boolean sInitialized = false; | 22 private static boolean sInitialized; |
23 private static boolean sForceDisableEditing = false; | 23 private static boolean sForceDisableEditing; |
24 | 24 |
25 /** Root bookmark id reserved for the implied root of the bookmarks */ | 25 /** Root bookmark id reserved for the implied root of the bookmarks */ |
26 static final long ROOT_FOLDER_ID = 0; | 26 static final long ROOT_FOLDER_ID = 0; |
27 | 27 |
28 /** ID used to indicate an invalid bookmark node. */ | 28 /** ID used to indicate an invalid bookmark node. */ |
29 static final long INVALID_BOOKMARK_ID = -1; | 29 static final long INVALID_BOOKMARK_ID = -1; |
30 | 30 |
31 // JNI c++ pointer | 31 // JNI c++ pointer |
32 private long mNativePartnerBookmarksReader = 0; | 32 private long mNativePartnerBookmarksReader; |
33 | 33 |
34 /** The context (used to get a ContentResolver) */ | 34 /** The context (used to get a ContentResolver) */ |
35 protected Context mContext; | 35 protected Context mContext; |
36 | 36 |
37 // TODO(aruslan): Move it out to a separate class that defines | 37 // TODO(aruslan): Move it out to a separate class that defines |
38 // a partner bookmarks provider contract, see http://b/6399404 | 38 // a partner bookmarks provider contract, see http://b/6399404 |
39 /** Object defining a partner bookmark. For this package only. */ | 39 /** Object defining a partner bookmark. For this package only. */ |
40 static class Bookmark { | 40 static class Bookmark { |
41 // To be provided by the bookmark extractors. | 41 // To be provided by the bookmark extractors. |
42 /** Local id of the read bookmark */ | 42 /** Local id of the read bookmark */ |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // JNI | 263 // JNI |
264 private native long nativeInit(); | 264 private native long nativeInit(); |
265 private native void nativeReset(long nativePartnerBookmarksReader); | 265 private native void nativeReset(long nativePartnerBookmarksReader); |
266 private native void nativeDestroy(long nativePartnerBookmarksReader); | 266 private native void nativeDestroy(long nativePartnerBookmarksReader); |
267 private native long nativeAddPartnerBookmark(long nativePartnerBookmarksRead
er, | 267 private native long nativeAddPartnerBookmark(long nativePartnerBookmarksRead
er, |
268 String url, String title, boolean isFolder, long parentId, | 268 String url, String title, boolean isFolder, long parentId, |
269 byte[] favicon, byte[] touchicon); | 269 byte[] favicon, byte[] touchicon); |
270 private native void nativePartnerBookmarksCreationComplete(long nativePartne
rBookmarksReader); | 270 private native void nativePartnerBookmarksCreationComplete(long nativePartne
rBookmarksReader); |
271 private static native void nativeDisablePartnerBookmarksEditing(); | 271 private static native void nativeDisablePartnerBookmarksEditing(); |
272 } | 272 } |
OLD | NEW |