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

Side by Side Diff: ios/chrome/browser/signin/browser_state_data_remover.h

Issue 2390003003: Upstream helper method to clear data using BrowserStateDataRemover. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | ios/chrome/browser/signin/browser_state_data_remover.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_ 5 #ifndef IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_
6 #define IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_ 6 #define IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_
7 7
8 #include "base/ios/block_types.h" 8 #include "base/ios/block_types.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h" 10 #include "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h"
11 11
12 namespace ios { 12 namespace ios {
13 class ChromeBrowserState; 13 class ChromeBrowserState;
14 } 14 }
15 15
16 // Helper that wipes all the data in the given browser state. This deletes all 16 // Helper that wipes all the data in the given browser state. This deletes all
17 // browsing data and all the bookmarks. 17 // browsing data and all the bookmarks.
18 class BrowserStateDataRemover { 18 class BrowserStateDataRemover {
19 public: 19 public:
20 explicit BrowserStateDataRemover(ios::ChromeBrowserState* browser_state); 20 explicit BrowserStateDataRemover(ios::ChromeBrowserState* browser_state);
21 ~BrowserStateDataRemover(); 21 ~BrowserStateDataRemover();
22 22
23 // Removes all bookmarks, clears all browsing data, last signed-in username
24 // and then runs |completion|. The user must be signed out when this method
25 // is called.
26 static void ClearData(ios::ChromeBrowserState* browser_state,
27 ProceduralBlock completion);
28
23 // If set then the last username will be removed from the browser state prefs 29 // If set then the last username will be removed from the browser state prefs
24 // after the data has been wiped. 30 // after the data has been wiped.
25 void SetForgetLastUsername(); 31 void SetForgetLastUsername();
26 32
27 // Wipes all the data in the browser state and invokes |callback| when done. 33 // Wipes all the data in the browser state and invokes |callback| when done.
28 // This can be called only once, and this object deletes itself after invoking 34 // This can be called only once, and this object deletes itself after invoking
29 // the callback. 35 // the callback.
30 void RemoveBrowserStateData(ProceduralBlock callback); 36 void RemoveBrowserStateData(ProceduralBlock callback);
31 37
32 private: 38 private:
33 void NotifyWithDetails( 39 void NotifyWithDetails(
34 const IOSChromeBrowsingDataRemover::NotificationDetails& details); 40 const IOSChromeBrowsingDataRemover::NotificationDetails& details);
35 41
36 ios::ChromeBrowserState* browser_state_; 42 ios::ChromeBrowserState* browser_state_;
37 base::scoped_nsprotocol<ProceduralBlock> callback_; 43 base::scoped_nsprotocol<ProceduralBlock> callback_;
38 IOSChromeBrowsingDataRemover::CallbackSubscription callback_subscription_; 44 IOSChromeBrowsingDataRemover::CallbackSubscription callback_subscription_;
39 bool forget_last_username_; 45 bool forget_last_username_;
40 }; 46 };
41 47
42 #endif // IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_ 48 #endif // IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/signin/browser_state_data_remover.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698