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

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: Added missing signal.h 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
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 const char* command = is_service_running_ ? "--save-config" : "--enable"; 517 const char* command = is_service_running_ ? "--save-config" : "--enable";
518 if (![self runHelperAsRootWithCommand:command 518 if (![self runHelperAsRootWithCommand:command
519 inputData:serialized_config]) { 519 inputData:serialized_config]) {
520 NSLog(@"Failed to run the helper tool"); 520 NSLog(@"Failed to run the helper tool");
521 [self showError]; 521 [self showError];
522 return; 522 return;
523 } 523 }
524 524
525 have_new_config_ = NO; 525 have_new_config_ = NO;
526 526
527 // If the service is running, send a signal to cause it to reload its 527 // Ensure the service is started.
528 // configuration, otherwise start the service. 528 if (!is_service_running_) {
529 if (is_service_running_) {
530 pid_t job_pid = base::mac::PIDForJob(remoting::kServiceName);
531 if (job_pid > 0) {
532 kill(job_pid, SIGHUP);
533 } else {
534 NSLog(@"Failed to obtain PID of service %s", remoting::kServiceName);
535 [self showError];
536 }
537 } else {
538 [self sendJobControlMessage:LAUNCH_KEY_STARTJOB]; 529 [self sendJobControlMessage:LAUNCH_KEY_STARTJOB];
539 } 530 }
540 531
541 // Broadcast a distributed notification to inform the plugin that the 532 // Broadcast a distributed notification to inform the plugin that the
542 // configuration has been applied. 533 // configuration has been applied.
543 [self notifyPlugin:UPDATE_SUCCEEDED_NOTIFICATION_NAME]; 534 [self notifyPlugin:UPDATE_SUCCEEDED_NOTIFICATION_NAME];
544 } 535 }
545 536
546 - (BOOL)runHelperAsRootWithCommand:(const char*)command 537 - (BOOL)runHelperAsRootWithCommand:(const char*)command
547 inputData:(const std::string&)input_data { 538 inputData:(const std::string&)input_data {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; 746 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil];
756 [task setLaunchPath:command]; 747 [task setLaunchPath:command];
757 [task setArguments:arguments]; 748 [task setArguments:arguments];
758 [task setStandardInput:[NSPipe pipe]]; 749 [task setStandardInput:[NSPipe pipe]];
759 [task launch]; 750 [task launch];
760 [task release]; 751 [task release];
761 [NSApp terminate:nil]; 752 [NSApp terminate:nil];
762 } 753 }
763 754
764 @end 755 @end
OLDNEW
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698