OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <Cocoa/Cocoa.h> |
| 6 #import <PreferencePanes/PreferencePanes.h> |
| 7 #import <SecurityInterface/SFAuthorizationView.h> |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace remoting { |
| 14 class JsonHostConfig; |
| 15 } |
| 16 |
| 17 @interface Me2MePreferencePane : NSPreferencePane { |
| 18 IBOutlet NSTextField* status_message_; |
| 19 IBOutlet NSButton* disable_button_; |
| 20 IBOutlet NSTextField* pin_instruction_message_; |
| 21 IBOutlet NSTextField* email_; |
| 22 IBOutlet NSTextField* pin_; |
| 23 IBOutlet NSButton* apply_button_; |
| 24 IBOutlet SFAuthorizationView* authorization_view_; |
| 25 |
| 26 // Holds the new proposed configuration if a temporary config file is |
| 27 // present. |
| 28 scoped_ptr<remoting::JsonHostConfig> config_; |
| 29 |
| 30 NSTimer* service_status_timer_; |
| 31 |
| 32 // These flags determine the UI state. These are computed in the |
| 33 // update...Status methods. |
| 34 BOOL is_service_running_; |
| 35 BOOL is_pane_unlocked_; |
| 36 |
| 37 // True if a new proposed config file has been loaded into memory. |
| 38 BOOL have_new_config_; |
| 39 } |
| 40 |
| 41 - (void)mainViewDidLoad; |
| 42 - (void)willSelect; |
| 43 - (void)willUnselect; |
| 44 - (IBAction)onDisable:(id)sender; |
| 45 - (IBAction)onApply:(id)sender; |
| 46 - (void)onNewConfigFile:(NSNotification*)notification; |
| 47 - (void)refreshServiceStatus:(NSTimer*)timer; |
| 48 - (void)authorizationViewDidAuthorize:(SFAuthorizationView*)view; |
| 49 - (void)authorizationViewDidDeauthorize:(SFAuthorizationView*)view; |
| 50 - (void)updateServiceStatus; |
| 51 - (void)updateAuthorizationStatus; |
| 52 |
| 53 // Read any new config file if present. If a config file is successfully read, |
| 54 // this deletes the file and keeps the config data loaded in memory. If this |
| 55 // method is called a second time (when the file has been deleted), the current |
| 56 // config is remembered, so this method acts as a latch: it can change |
| 57 // |have_new_config_| from NO to YES, but never from YES to NO. |
| 58 // |
| 59 // This scheme means that this method can delete the file immediately (to avoid |
| 60 // leaving a stale file around in case of a crash), but this method can safely |
| 61 // be called multiple times without forgetting the loaded config. To explicitly |
| 62 // forget the current config, set |have_new_config_| to NO. |
| 63 - (void)readNewConfig; |
| 64 |
| 65 // Update all UI controls according to any stored flags and loaded config. |
| 66 // This should be called after any sequence of operations that might change the |
| 67 // UI state. |
| 68 - (void)updateUI; |
| 69 |
| 70 // Alert the user to a generic error condition. |
| 71 - (void)showError; |
| 72 |
| 73 // Alert the user that the typed PIN is incorrect. |
| 74 - (void)showIncorrectPinMessage; |
| 75 |
| 76 // Save the new config to the system, and either start the service or inform |
| 77 // the currently-running service of the new config. |
| 78 - (void)applyNewServiceConfig; |
| 79 |
| 80 - (BOOL)runHelperAsRootWithCommand:(const char*)command |
| 81 inputData:(const std::string&)input_data; |
| 82 - (BOOL)sendJobControlMessage:(const char*)launch_key; |
| 83 |
| 84 @end |
OLD | NEW |