| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_EXTERNAL_FILE_REMOVER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_ | 6 #define IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Removes files received from other apps. If |all_files| is true, then | 39 // Removes files received from other apps. If |all_files| is true, then |
| 40 // all files including files that may be referenced by tabs through restore | 40 // all files including files that may be referenced by tabs through restore |
| 41 // service or history. Otherwise, only the unreferenced files are removed. | 41 // service or history. Otherwise, only the unreferenced files are removed. |
| 42 // |callback| is called when the removal finishes. | 42 // |callback| is called when the removal finishes. |
| 43 void RemoveFiles(bool all_files, const base::Closure& callback); | 43 void RemoveFiles(bool all_files, const base::Closure& callback); |
| 44 // Pointer to the tab restore service in the browser state associated with | 44 // Pointer to the tab restore service in the browser state associated with |
| 45 // |bvc_|. | 45 // |bvc_|. |
| 46 sessions::TabRestoreService* tabRestoreService_; | 46 sessions::TabRestoreService* tabRestoreService_; |
| 47 // BrowserViewController used to get the referenced files. Must outlive this | 47 // BrowserViewController used to get the referenced files. Must outlive this |
| 48 // object. | 48 // object. |
| 49 BrowserViewController* bvc_; | 49 __unsafe_unretained BrowserViewController* bvc_; |
| 50 // Used to ensure |Remove()| is not run when this object is destroyed. | 50 // Used to ensure |Remove()| is not run when this object is destroyed. |
| 51 base::WeakPtrFactory<ExternalFileRemover> weak_ptr_factory_; | 51 base::WeakPtrFactory<ExternalFileRemover> weak_ptr_factory_; |
| 52 // Loads the |tabRestoreService_| if necessary. Removes all files received | 52 // Loads the |tabRestoreService_| if necessary. Removes all files received |
| 53 // from other apps if |all_files| is true. Otherwise, removes the unreferenced | 53 // from other apps if |all_files| is true. Otherwise, removes the unreferenced |
| 54 // files only. |callback| is called when the removal finishes. | 54 // files only. |callback| is called when the removal finishes. |
| 55 void Remove(bool all_files, const base::Closure& callback); | 55 void Remove(bool all_files, const base::Closure& callback); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 #endif // IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_ | 58 #endif // IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_ |
| OLD | NEW |