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