Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.mm

Issue 10807061: [Chromoting] Update uninstaller to facilitate testing automation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(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 #include "remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/mac/scoped_cftyperef.h"
10 #include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h"
11
12 @implementation RemotingUninstallerAppDelegate
13
14 - (void)dealloc {
15 [super dealloc];
16 }
17
18 - (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
19 }
20
21 - (void)messageBox:(const char*)message {
22 base::mac::ScopedCFTypeRef<CFStringRef> message_ref(
23 CFStringCreateWithCString(kCFAllocatorDefault, message,
24 kCFStringEncodingUTF8));
25 CFOptionFlags result;
26 CFUserNotificationDisplayAlert(0, kCFUserNotificationNoteAlertLevel,
dcaiafa 2012/07/23 23:16:01 CF23Alert should only be used when the application
27 NULL, NULL, NULL,
28 CFSTR("Chrome Remote Desktop Uninstaller"),
29 message_ref, NULL, NULL, NULL, &result);
30 }
31
32 - (IBAction)uninstall:(NSButton*)sender {
33 @try {
34 NSLog(@"Chrome Remote Desktop uninstall starting.");
35
36 RemotingUninstaller* uninstaller =
37 [[[RemotingUninstaller alloc] init] autorelease];
38 OSStatus status = [uninstaller remotingUninstall];
39
40 NSLog(@"Chrome Remote Desktop Host uninstall complete.");
41
42 const char* message = NULL;
43 if (status == errAuthorizationSuccess) {
44 message = "Chrome Remote Desktop Host was successfully uninstalled.";
45 } else if (status == errAuthorizationCanceled) {
46 message = "Chrome Remote Desktop Host uninstall canceled.";
47 } else if (status == errAuthorizationDenied) {
48 message = "Chrome Remote Desktop Host uninstall authorization denied.";
49 } else {
50 [NSException raise:@"AuthorizationCopyRights Failure"
51 format:@"Error during AuthorizationCopyRights status=%ld", status];
52 }
53 if (message != NULL) {
54 NSLog(@"%s", message);
55 [self messageBox:message];
56 }
57 }
58 @catch (NSException* exception) {
59 NSLog(@"Exception %@ %@", [exception name], [exception reason]);
60 const char* message =
61 "Error! Unable to uninstall Chrome Remote Desktop Host.";
62 [self messageBox:message];
63 }
64
65 [NSApp terminate:self];
66 }
67
68 - (IBAction)cancel:(id)sender {
69 [NSApp terminate:self];
70 }
71
72 - (IBAction)handleMenuClose:(NSMenuItem*)sender {
73 [NSApp terminate:self];
74 }
75
76 @end
77
78 int main(int argc, char* argv[])
79 {
80 // The no-ui option skips the UI confirmatino dialogs. This is provided as
Lambros 2012/07/23 23:48:54 typo: confirmatino
81 // a convenience for our automated testing.
82 // There will still be an elevation prompt unless the command is run as root.
83 if (argc == 2 && !strcmp(argv[1], "--no-ui")) {
84 @autoreleasepool {
85 NSLog(@"Chrome Remote Desktop uninstall starting.");
86 NSLog(@"--no-ui : Suppressing UI");
87
88 RemotingUninstaller* uninstaller =
89 [[[RemotingUninstaller alloc] init] autorelease];
90 OSStatus status = [uninstaller remotingUninstall];
91
92 NSLog(@"Chrome Remote Desktop Host uninstall complete.");
93 NSLog(@"Status = %ld", status);
94 return status != errAuthorizationSuccess;
95 }
96 } else {
97 return NSApplicationMain(argc, (const char**)argv);
98 }
99 }
100
OLDNEW
« no previous file with comments | « remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.h ('k') | remoting/host/me2me_preference_pane.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698