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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/sync/SyncUserDataWiper.java

Issue 2756173002: Move code about browsing data from PrefServiceBridge to BrowsingDataBridge. (Closed)
Patch Set: fix comments Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 org.chromium.base.Promise; 7 import org.chromium.base.Promise;
8 import org.chromium.chrome.browser.bookmarks.BookmarkModel; 8 import org.chromium.chrome.browser.bookmarks.BookmarkModel;
9 import org.chromium.chrome.browser.browsing_data.BrowsingDataType; 9 import org.chromium.chrome.browser.browsing_data.BrowsingDataType;
10 import org.chromium.chrome.browser.browsing_data.TimePeriod; 10 import org.chromium.chrome.browser.browsing_data.TimePeriod;
11 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 11 import org.chromium.chrome.browser.preferences.privacy.BrowsingDataBridge;
12 import org.chromium.chrome.browser.preferences.PrefServiceBridge.OnClearBrowsing DataListener; 12 import org.chromium.chrome.browser.preferences.privacy.BrowsingDataBridge.OnClea rBrowsingDataListener;
13 13
14 /** 14 /**
15 * A class to wipe the user's bookmarks and all types of sync data. 15 * A class to wipe the user's bookmarks and all types of sync data.
16 */ 16 */
17 public class SyncUserDataWiper { 17 public class SyncUserDataWiper {
18 private static final int[] SYNC_DATA_TYPES = { 18 private static final int[] SYNC_DATA_TYPES = {
19 BrowsingDataType.HISTORY, 19 BrowsingDataType.HISTORY,
20 BrowsingDataType.CACHE, 20 BrowsingDataType.CACHE,
21 BrowsingDataType.COOKIES, 21 BrowsingDataType.COOKIES,
22 BrowsingDataType.PASSWORDS, 22 BrowsingDataType.PASSWORDS,
23 BrowsingDataType.FORM_DATA 23 BrowsingDataType.FORM_DATA
24 }; 24 };
25 25
26 /** 26 /**
27 * Wipes the user's bookmarks and sync data. 27 * Wipes the user's bookmarks and sync data.
28 * @return A promise which will be fulfilled once the data is wiped. 28 * @return A promise which will be fulfilled once the data is wiped.
29 */ 29 */
30 public static Promise<Void> wipeSyncUserData() { 30 public static Promise<Void> wipeSyncUserData() {
31 final Promise<Void> promise = new Promise<>(); 31 final Promise<Void> promise = new Promise<>();
32 32
33 final BookmarkModel model = new BookmarkModel(); 33 final BookmarkModel model = new BookmarkModel();
34 model.runAfterBookmarkModelLoaded(new Runnable() { 34 model.runAfterBookmarkModelLoaded(new Runnable() {
35 @Override 35 @Override
36 public void run() { 36 public void run() {
37 model.removeAllUserBookmarks(); 37 model.removeAllUserBookmarks();
38 model.destroy(); 38 model.destroy();
39 PrefServiceBridge.getInstance().clearBrowsingData( 39 BrowsingDataBridge.getInstance().clearBrowsingData(
40 new OnClearBrowsingDataListener(){ 40 new OnClearBrowsingDataListener() {
41 @Override 41 @Override
42 public void onBrowsingDataCleared() { 42 public void onBrowsingDataCleared() {
43 promise.fulfill(null); 43 promise.fulfill(null);
44 } 44 }
45 }, 45 },
46 SYNC_DATA_TYPES, TimePeriod.ALL_TIME); 46 SYNC_DATA_TYPES, TimePeriod.ALL_TIME);
47 } 47 }
48 }); 48 });
49 49
50 return promise; 50 return promise;
51 } 51 }
52 } 52 }
53 53
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698