| OLD | NEW |
| 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 namespace reading_list { |
| 17 class ReadingListRemoverHelper; |
| 18 } |
| 19 |
| 16 // Helper that wipes all the data in the given browser state. This deletes all | 20 // Helper that wipes all the data in the given browser state. This deletes all |
| 17 // browsing data and all the bookmarks. | 21 // browsing data and all the bookmarks. |
| 18 class BrowserStateDataRemover { | 22 class BrowserStateDataRemover { |
| 19 public: | 23 public: |
| 20 explicit BrowserStateDataRemover(ios::ChromeBrowserState* browser_state); | 24 explicit BrowserStateDataRemover(ios::ChromeBrowserState* browser_state); |
| 21 ~BrowserStateDataRemover(); | 25 ~BrowserStateDataRemover(); |
| 22 | 26 |
| 23 // Removes all bookmarks, clears all browsing data, last signed-in username | 27 // 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 | 28 // and then runs |completion|. The user must be signed out when this method |
| 25 // is called. | 29 // is called. |
| 26 static void ClearData(ios::ChromeBrowserState* browser_state, | 30 static void ClearData(ios::ChromeBrowserState* browser_state, |
| 27 ProceduralBlock completion); | 31 ProceduralBlock completion); |
| 28 | 32 |
| 29 // If set then the last username will be removed from the browser state prefs | 33 // If set then the last username will be removed from the browser state prefs |
| 30 // after the data has been wiped. | 34 // after the data has been wiped. |
| 31 void SetForgetLastUsername(); | 35 void SetForgetLastUsername(); |
| 32 | 36 |
| 33 // Wipes all the data in the browser state and invokes |callback| when done. | 37 // Wipes all the data in the browser state and invokes |callback| when done. |
| 34 // This can be called only once, and this object deletes itself after invoking | 38 // This can be called only once, and this object deletes itself after invoking |
| 35 // the callback. | 39 // the callback. |
| 36 void RemoveBrowserStateData(ProceduralBlock callback); | 40 void RemoveBrowserStateData(ProceduralBlock callback); |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 void NotifyWithDetails( | 43 void NotifyWithDetails( |
| 40 const IOSChromeBrowsingDataRemover::NotificationDetails& details); | 44 const IOSChromeBrowsingDataRemover::NotificationDetails& details); |
| 45 void ReadingListCleaned( |
| 46 const IOSChromeBrowsingDataRemover::NotificationDetails& details, |
| 47 bool reading_list_cleaned); |
| 41 | 48 |
| 42 ios::ChromeBrowserState* browser_state_; | 49 ios::ChromeBrowserState* browser_state_; |
| 43 base::scoped_nsprotocol<ProceduralBlock> callback_; | 50 base::scoped_nsprotocol<ProceduralBlock> callback_; |
| 44 IOSChromeBrowsingDataRemover::CallbackSubscription callback_subscription_; | 51 IOSChromeBrowsingDataRemover::CallbackSubscription callback_subscription_; |
| 52 std::unique_ptr<reading_list::ReadingListRemoverHelper> |
| 53 reading_list_remover_helper_; |
| 45 bool forget_last_username_; | 54 bool forget_last_username_; |
| 46 }; | 55 }; |
| 47 | 56 |
| 48 #endif // IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_ | 57 #endif // IOS_CHROME_BROWSER_SIGNIN_BROWSER_STATE_DATA_REMOVER_H_ |
| OLD | NEW |