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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.mm
===================================================================
--- remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.mm (revision 0)
+++ remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.mm (working copy)
@@ -0,0 +1,100 @@
+// 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.
+
+#include "remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.h"
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/mac/scoped_cftyperef.h"
+#include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h"
+
+@implementation RemotingUninstallerAppDelegate
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
+}
+
+- (void)messageBox:(const char*)message {
+ base::mac::ScopedCFTypeRef<CFStringRef> message_ref(
+ CFStringCreateWithCString(kCFAllocatorDefault, message,
+ kCFStringEncodingUTF8));
+ CFOptionFlags result;
+ CFUserNotificationDisplayAlert(0, kCFUserNotificationNoteAlertLevel,
dcaiafa 2012/07/23 23:16:01 CF23Alert should only be used when the application
+ NULL, NULL, NULL,
+ CFSTR("Chrome Remote Desktop Uninstaller"),
+ message_ref, NULL, NULL, NULL, &result);
+}
+
+- (IBAction)uninstall:(NSButton*)sender {
+ @try {
+ NSLog(@"Chrome Remote Desktop uninstall starting.");
+
+ RemotingUninstaller* uninstaller =
+ [[[RemotingUninstaller alloc] init] autorelease];
+ OSStatus status = [uninstaller remotingUninstall];
+
+ NSLog(@"Chrome Remote Desktop Host uninstall complete.");
+
+ const char* message = NULL;
+ if (status == errAuthorizationSuccess) {
+ message = "Chrome Remote Desktop Host was successfully uninstalled.";
+ } else if (status == errAuthorizationCanceled) {
+ message = "Chrome Remote Desktop Host uninstall canceled.";
+ } else if (status == errAuthorizationDenied) {
+ message = "Chrome Remote Desktop Host uninstall authorization denied.";
+ } else {
+ [NSException raise:@"AuthorizationCopyRights Failure"
+ format:@"Error during AuthorizationCopyRights status=%ld", status];
+ }
+ if (message != NULL) {
+ NSLog(@"%s", message);
+ [self messageBox:message];
+ }
+ }
+ @catch (NSException* exception) {
+ NSLog(@"Exception %@ %@", [exception name], [exception reason]);
+ const char* message =
+ "Error! Unable to uninstall Chrome Remote Desktop Host.";
+ [self messageBox:message];
+ }
+
+ [NSApp terminate:self];
+}
+
+- (IBAction)cancel:(id)sender {
+ [NSApp terminate:self];
+}
+
+- (IBAction)handleMenuClose:(NSMenuItem*)sender {
+ [NSApp terminate:self];
+}
+
+@end
+
+int main(int argc, char* argv[])
+{
+ // The no-ui option skips the UI confirmatino dialogs. This is provided as
Lambros 2012/07/23 23:48:54 typo: confirmatino
+ // a convenience for our automated testing.
+ // There will still be an elevation prompt unless the command is run as root.
+ if (argc == 2 && !strcmp(argv[1], "--no-ui")) {
+ @autoreleasepool {
+ NSLog(@"Chrome Remote Desktop uninstall starting.");
+ NSLog(@"--no-ui : Suppressing UI");
+
+ RemotingUninstaller* uninstaller =
+ [[[RemotingUninstaller alloc] init] autorelease];
+ OSStatus status = [uninstaller remotingUninstall];
+
+ NSLog(@"Chrome Remote Desktop Host uninstall complete.");
+ NSLog(@"Status = %ld", status);
+ return status != errAuthorizationSuccess;
+ }
+ } else {
+ return NSApplicationMain(argc, (const char**)argv);
+ }
+}
+
Property changes on: remoting/host/installer/mac/uninstaller/remoting_uninstaller_app.mm
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
« 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