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 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.util.Log; | 9 import android.util.Log; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 private String mNodesString; | 57 private String mNodesString; |
58 private boolean mHasResult = false; | 58 private boolean mHasResult = false; |
59 | 59 |
60 // Invoked when getAllNodes completes. | 60 // Invoked when getAllNodes completes. |
61 public void onResult(String nodesString) { | 61 public void onResult(String nodesString) { |
62 mNodesString = nodesString; | 62 mNodesString = nodesString; |
63 mHasResult = true; | 63 mHasResult = true; |
64 } | 64 } |
65 | 65 |
66 // Whether this callback contains a result. | 66 // Whether this callback contains a result. |
67 public boolean hasResult() { | 67 public boolean hasResult() { |
pval...(no longer on Chromium)
2015/05/21 01:13:55
This method can be deleted entirely. I ended up de
| |
68 return mHasResult; | 68 return mHasResult; |
69 } | 69 } |
70 | 70 |
71 // Returns the result of GetAllNodes as a JSONArray. | 71 // Returns the result of GetAllNodes as a JSONArray. |
72 @VisibleForTesting | |
72 public JSONArray getNodesAsJsonArray() throws JSONException { | 73 public JSONArray getNodesAsJsonArray() throws JSONException { |
73 return new JSONArray(mNodesString); | 74 return new JSONArray(mNodesString); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 private static final String TAG = "ProfileSyncService"; | 78 private static final String TAG = "ProfileSyncService"; |
78 | 79 |
79 @VisibleForTesting | 80 @VisibleForTesting |
80 public static final String SESSION_TAG_PREFIX = "session_sync"; | 81 public static final String SESSION_TAG_PREFIX = "session_sync"; |
81 | 82 |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 */ | 618 */ |
618 @CalledByNative | 619 @CalledByNative |
619 private static void onGetAllNodesResult(GetAllNodesCallback callback, String nodes) { | 620 private static void onGetAllNodesResult(GetAllNodesCallback callback, String nodes) { |
620 callback.onResult(nodes); | 621 callback.onResult(nodes); |
621 } | 622 } |
622 | 623 |
623 /** | 624 /** |
624 * Retrieves a JSON version of local Sync data via the native GetAllNodes me thod. | 625 * Retrieves a JSON version of local Sync data via the native GetAllNodes me thod. |
625 * This method is asynchronous; the result will be sent to the callback. | 626 * This method is asynchronous; the result will be sent to the callback. |
626 */ | 627 */ |
628 @VisibleForTesting | |
627 public void getAllNodes(GetAllNodesCallback callback) { | 629 public void getAllNodes(GetAllNodesCallback callback) { |
628 nativeGetAllNodes(mNativeProfileSyncServiceAndroid, callback); | 630 nativeGetAllNodes(mNativeProfileSyncServiceAndroid, callback); |
629 } | 631 } |
630 | 632 |
631 // Native methods | 633 // Native methods |
632 private native long nativeInit(); | 634 private native long nativeInit(); |
633 private native void nativeEnableSync(long nativeProfileSyncServiceAndroid); | 635 private native void nativeEnableSync(long nativeProfileSyncServiceAndroid); |
634 private native void nativeDisableSync(long nativeProfileSyncServiceAndroid); | 636 private native void nativeDisableSync(long nativeProfileSyncServiceAndroid); |
635 private native void nativeFlushDirectory(long nativeProfileSyncServiceAndroi d); | 637 private native void nativeFlushDirectory(long nativeProfileSyncServiceAndroi d); |
636 private native void nativeSignInSync(long nativeProfileSyncServiceAndroid); | 638 private native void nativeSignInSync(long nativeProfileSyncServiceAndroid); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 private native boolean nativeIsPassphrasePrompted(long nativeProfileSyncServ iceAndroid); | 681 private native boolean nativeIsPassphrasePrompted(long nativeProfileSyncServ iceAndroid); |
680 private native void nativeSetPassphrasePrompted(long nativeProfileSyncServic eAndroid, | 682 private native void nativeSetPassphrasePrompted(long nativeProfileSyncServic eAndroid, |
681 boolean prompted); | 683 boolean prompted); |
682 private native String nativeGetAboutInfoForTest(long nativeProfileSyncServic eAndroid); | 684 private native String nativeGetAboutInfoForTest(long nativeProfileSyncServic eAndroid); |
683 private native long nativeGetLastSyncedTimeForTest(long nativeProfileSyncSer viceAndroid); | 685 private native long nativeGetLastSyncedTimeForTest(long nativeProfileSyncSer viceAndroid); |
684 private native void nativeOverrideNetworkResourcesForTest( | 686 private native void nativeOverrideNetworkResourcesForTest( |
685 long nativeProfileSyncServiceAndroid, long networkResources); | 687 long nativeProfileSyncServiceAndroid, long networkResources); |
686 private native void nativeGetAllNodes( | 688 private native void nativeGetAllNodes( |
687 long nativeProfileSyncServiceAndroid, GetAllNodesCallback callback); | 689 long nativeProfileSyncServiceAndroid, GetAllNodesCallback callback); |
688 } | 690 } |
OLD | NEW |