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

Side by Side Diff: remoting/host/me2me_preference_pane.mm

Issue 10855249: [Chromoting] The daemon process now starts the networking process and passes the host configuration… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback + rebased on top of https://chromiumcodereview.appspot.com/10829467/ (Patch Set 5) Created 8 years, 3 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
OLDNEW
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 "remoting/host/me2me_preference_pane.h" 5 #import "remoting/host/me2me_preference_pane.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <CommonCrypto/CommonHMAC.h> 8 #include <CommonCrypto/CommonHMAC.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <launch.h> 10 #include <launch.h>
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 const char* command = is_service_running_ ? "--save-config" : "--enable"; 516 const char* command = is_service_running_ ? "--save-config" : "--enable";
517 if (![self runHelperAsRootWithCommand:command 517 if (![self runHelperAsRootWithCommand:command
518 inputData:serialized_config]) { 518 inputData:serialized_config]) {
519 NSLog(@"Failed to run the helper tool"); 519 NSLog(@"Failed to run the helper tool");
520 [self showError]; 520 [self showError];
521 return; 521 return;
522 } 522 }
523 523
524 have_new_config_ = NO; 524 have_new_config_ = NO;
525 525
526 // If the service is running, send a signal to cause it to reload its 526 // Ensure the service is started.
527 // configuration, otherwise start the service. 527 if (!is_service_running_) {
528 if (is_service_running_) {
529 pid_t job_pid = base::mac::PIDForJob(remoting::kServiceName);
530 if (job_pid > 0) {
531 kill(job_pid, SIGHUP);
532 } else {
533 NSLog(@"Failed to obtain PID of service %s", remoting::kServiceName);
534 [self showError];
535 }
536 } else {
537 [self sendJobControlMessage:LAUNCH_KEY_STARTJOB]; 528 [self sendJobControlMessage:LAUNCH_KEY_STARTJOB];
538 } 529 }
539 530
540 // Broadcast a distributed notification to inform the plugin that the 531 // Broadcast a distributed notification to inform the plugin that the
541 // configuration has been applied. 532 // configuration has been applied.
542 [self notifyPlugin:UPDATE_SUCCEEDED_NOTIFICATION_NAME]; 533 [self notifyPlugin:UPDATE_SUCCEEDED_NOTIFICATION_NAME];
543 } 534 }
544 535
545 - (BOOL)runHelperAsRootWithCommand:(const char*)command 536 - (BOOL)runHelperAsRootWithCommand:(const char*)command
546 inputData:(const std::string&)input_data { 537 inputData:(const std::string&)input_data {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; 745 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil];
755 [task setLaunchPath:command]; 746 [task setLaunchPath:command];
756 [task setArguments:arguments]; 747 [task setArguments:arguments];
757 [task setStandardInput:[NSPipe pipe]]; 748 [task setStandardInput:[NSPipe pipe]];
758 [task launch]; 749 [task launch];
759 [task release]; 750 [task release];
760 [NSApp terminate:nil]; 751 [NSApp terminate:nil];
761 } 752 }
762 753
763 @end 754 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698