| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #import <PreferencePanes/PreferencePanes.h> | 6 #import <PreferencePanes/PreferencePanes.h> |
| 7 #import <SecurityInterface/SFAuthorizationView.h> | 7 #import <SecurityInterface/SFAuthorizationView.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // update...Status methods. | 58 // update...Status methods. |
| 59 BOOL is_service_running_; | 59 BOOL is_service_running_; |
| 60 BOOL is_pane_unlocked_; | 60 BOOL is_pane_unlocked_; |
| 61 | 61 |
| 62 // True if a new proposed config file has been loaded into memory. | 62 // True if a new proposed config file has been loaded into memory. |
| 63 BOOL have_new_config_; | 63 BOOL have_new_config_; |
| 64 | 64 |
| 65 // True if launchd has been instructed to stop the service and we are waiting | 65 // True if launchd has been instructed to stop the service and we are waiting |
| 66 // for the operation to complete. | 66 // for the operation to complete. |
| 67 BOOL awaiting_service_stop_; | 67 BOOL awaiting_service_stop_; |
| 68 |
| 69 // True if a version-mismatch has been detected. If true, this causes all |
| 70 // controls to be greyed out, and also prevents any config file from being |
| 71 // deleted, pending a restart of the preference pane. |
| 72 BOOL restart_pending_or_canceled_; |
| 68 } | 73 } |
| 69 | 74 |
| 70 - (void)mainViewDidLoad; | 75 - (void)mainViewDidLoad; |
| 71 - (void)willSelect; | 76 - (void)willSelect; |
| 77 - (void)didSelect; |
| 72 - (void)willUnselect; | 78 - (void)willUnselect; |
| 73 - (void)onDisable:(id)sender; | 79 - (void)onDisable:(id)sender; |
| 74 - (void)applyConfiguration:(id)sender | 80 - (void)applyConfiguration:(id)sender |
| 75 pin:(NSString*)pin; | 81 pin:(NSString*)pin; |
| 76 - (void)onNewConfigFile:(NSNotification*)notification; | 82 - (void)onNewConfigFile:(NSNotification*)notification; |
| 77 - (void)refreshServiceStatus:(NSTimer*)timer; | 83 - (void)refreshServiceStatus:(NSTimer*)timer; |
| 78 - (void)authorizationViewDidAuthorize:(SFAuthorizationView*)view; | 84 - (void)authorizationViewDidAuthorize:(SFAuthorizationView*)view; |
| 79 - (void)authorizationViewDidDeauthorize:(SFAuthorizationView*)view; | 85 - (void)authorizationViewDidDeauthorize:(SFAuthorizationView*)view; |
| 80 - (void)updateServiceStatus; | 86 - (void)updateServiceStatus; |
| 81 - (void)updateAuthorizationStatus; | 87 - (void)updateAuthorizationStatus; |
| 82 | 88 |
| 83 // Read any new config file if present. If a config file is successfully read, | 89 // Read any new config file if present. If a config file is successfully read, |
| 84 // this deletes the file and keeps the config data loaded in memory. If this | 90 // this deletes the file and keeps the config data loaded in memory. If this |
| 85 // method is called a second time (when the file has been deleted), the current | 91 // method is called a second time (when the file has been deleted), the current |
| 86 // config is remembered, so this method acts as a latch: it can change | 92 // config is remembered, so this method acts as a latch: it can change |
| 87 // |have_new_config_| from NO to YES, but never from YES to NO. | 93 // |have_new_config_| from NO to YES, but never from YES to NO. |
| 88 // | 94 // |
| 89 // This scheme means that this method can delete the file immediately (to avoid | 95 // This scheme means that this method can delete the file immediately (to avoid |
| 90 // leaving a stale file around in case of a crash), but this method can safely | 96 // leaving a stale file around in case of a crash), but this method can safely |
| 91 // be called multiple times without forgetting the loaded config. To explicitly | 97 // be called multiple times without forgetting the loaded config. To explicitly |
| 92 // forget the current config, set |have_new_config_| to NO. | 98 // forget the current config, set |have_new_config_| to NO. |
| 99 // |
| 100 // This method should not be called if |restart_pending_or_canceled_| is YES, |
| 101 // since this would delete any config file. |
| 93 - (void)readNewConfig; | 102 - (void)readNewConfig; |
| 94 | 103 |
| 95 // Update all UI controls according to any stored flags and loaded config. | 104 // Update all UI controls according to any stored flags and loaded config. |
| 96 // This should be called after any sequence of operations that might change the | 105 // This should be called after any sequence of operations that might change the |
| 97 // UI state. | 106 // UI state. |
| 98 - (void)updateUI; | 107 - (void)updateUI; |
| 99 | 108 |
| 100 // Alert the user to a generic error condition. | 109 // Alert the user to a generic error condition. |
| 101 - (void)showError; | 110 - (void)showError; |
| 102 | 111 |
| 103 // Alert the user that the typed PIN is incorrect. | 112 // Alert the user that the typed PIN is incorrect. |
| 104 - (void)showIncorrectPinMessage; | 113 - (void)showIncorrectPinMessage; |
| 105 | 114 |
| 106 // Save the new config to the system, and either start the service or inform | 115 // Save the new config to the system, and either start the service or inform |
| 107 // the currently-running service of the new config. | 116 // the currently-running service of the new config. |
| 108 - (void)applyNewServiceConfig; | 117 - (void)applyNewServiceConfig; |
| 109 | 118 |
| 110 - (BOOL)runHelperAsRootWithCommand:(const char*)command | 119 - (BOOL)runHelperAsRootWithCommand:(const char*)command |
| 111 inputData:(const std::string&)input_data; | 120 inputData:(const std::string&)input_data; |
| 112 - (BOOL)sendJobControlMessage:(const char*)launch_key; | 121 - (BOOL)sendJobControlMessage:(const char*)launch_key; |
| 113 | 122 |
| 114 // Compare the version of the running pref-pane against the installed version. | 123 // Compare the version of the running pref-pane against the installed version. |
| 115 // If the versions are mismatched, return YES and restart the System | 124 // If the versions are mismatched and the pref-pane is visible, disable the |
| 116 // Preferences application, so the correct version of this pref-pane is loaded. | 125 // pane to prevent interaction, and prompt the user to restart System |
| 117 - (BOOL)restartPanelIfDifferentVersionInstalled; | 126 // Preferences. |
| 127 // |
| 128 // This should be called on notification of a new config, and also in |
| 129 // |didSelect| when the pane becomes visible. The pane needs to be visible so |
| 130 // that the alert appears as a sheet over the pane (instead of a detached |
| 131 // window), which gives the user an appropriate context for the alert. |
| 132 // |
| 133 // In the case of a version-mismatch, the new config file should be kept until |
| 134 // System Preferences is restarted, or thrown away when the user cancels the |
| 135 // alert. This method sets the |restart_pending_or_canceled_| flag on |
| 136 // detecting version-mismatch. |
| 137 - (void)checkInstalledVersion; |
| 138 |
| 139 - (void)mismatchAlertDidEnd:(NSAlert*)alert |
| 140 returnCode:(NSInteger)returnCode |
| 141 contextInfo:(void*)contextInfo; |
| 142 |
| 143 // Called when the user chooses OK when prompted to restart System Preferences. |
| 144 - (void)restartSystemPreferences; |
| 118 | 145 |
| 119 @end | 146 @end |
| OLD | NEW |