OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_COCOA_CLEAR_BROWSING_DATA_CONTROLLER_ | |
6 #define CHROME_BROWSER_UI_COCOA_CLEAR_BROWSING_DATA_CONTROLLER_ | |
7 #pragma once | |
8 | |
9 #import <Cocoa/Cocoa.h> | |
10 | |
11 #include "base/scoped_ptr.h" | |
12 | |
13 class BrowsingDataRemover; | |
14 class ClearBrowsingObserver; | |
15 class Profile; | |
16 @class ThrobberView; | |
17 | |
18 // Name of notification that is called when data is cleared. | |
19 extern NSString* const kClearBrowsingDataControllerDidDelete; | |
20 // A key in the above notification's userInfo. Contains a NSNumber with the | |
21 // logically-ored constants defined in BrowsingDataRemover for the removal. | |
22 extern NSString* const kClearBrowsingDataControllerRemoveMask; | |
23 | |
24 // A window controller for managing the "Clear Browsing Data" feature. Modally | |
25 // presents a dialog offering the user a set of choices of what browsing data | |
26 // to delete and does so if the user chooses. | |
27 | |
28 @interface ClearBrowsingDataController : NSWindowController { | |
29 @private | |
30 Profile* profile_; // Weak, owned by browser. | |
31 // If non-null means there is a removal in progress. Member used mainly for | |
32 // automated tests. The remove deletes itself when it's done, so this is a | |
33 // weak reference. | |
34 BrowsingDataRemover* remover_; | |
35 scoped_ptr<ClearBrowsingObserver> observer_; | |
36 BOOL isClearing_; // YES while clearing data is ongoing. | |
37 | |
38 // Values for checkboxes, kept in sync with bindings. These values get | |
39 // persisted into prefs if the user accepts the dialog. | |
40 BOOL clearBrowsingHistory_; | |
41 BOOL clearDownloadHistory_; | |
42 BOOL emptyCache_; | |
43 BOOL deleteCookies_; | |
44 BOOL clearSavedPasswords_; | |
45 BOOL clearFormData_; | |
46 NSInteger timePeriod_; | |
47 } | |
48 | |
49 // Properties for bindings | |
50 @property(nonatomic) BOOL clearBrowsingHistory; | |
51 @property(nonatomic) BOOL clearDownloadHistory; | |
52 @property(nonatomic) BOOL emptyCache; | |
53 @property(nonatomic) BOOL deleteCookies; | |
54 @property(nonatomic) BOOL clearSavedPasswords; | |
55 @property(nonatomic) BOOL clearFormData; | |
56 @property(nonatomic) NSInteger timePeriod; | |
57 @property(nonatomic) BOOL isClearing; | |
58 | |
59 // Show the clear browsing data window. Do not use |-initWithProfile:|, | |
60 // go through this instead so we don't end up with multiple instances. | |
61 // This function does not block, so it can be used from WebUI calls. | |
62 + (void)showClearBrowsingDialogForProfile:(Profile*)profile; | |
63 + (ClearBrowsingDataController*)controllerForProfile:(Profile*)profile; | |
64 | |
65 // Run the dialog with an application-modal event loop. If the user accepts, | |
66 // performs the deletion of the selected browsing data. The values of the | |
67 // checkboxes will be persisted into prefs for next time. | |
68 - (void)runModalDialog; | |
69 | |
70 // IBActions for the dialog buttons | |
71 - (IBAction)clearData:(id)sender; | |
72 - (IBAction)cancel:(id)sender; | |
73 - (IBAction)openFlashPlayerSettings:(id)sender; | |
74 | |
75 @end | |
76 | |
77 | |
78 @interface ClearBrowsingDataController (ExposedForUnitTests) | |
79 @property(readonly) int removeMask; | |
80 | |
81 // Create the controller with the given profile (which must not be NULL). | |
82 - (id)initWithProfile:(Profile*)profile; | |
83 - (void)persistToPrefs; | |
84 - (void)closeDialog; | |
85 - (void)dataRemoverDidFinish; | |
86 @end | |
87 | |
88 #endif // CHROME_BROWSER_UI_COCOA_CLEAR_BROWSING_DATA_CONTROLLER_ | |
OLD | NEW |