| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <CoreFoundation/CoreFoundation.h> | 5 #include <CoreFoundation/CoreFoundation.h> |
| 6 | 6 |
| 7 #include "remoting/host/setup/daemon_controller_delegate_mac.h" | 7 #include "remoting/host/setup/daemon_controller_delegate_mac.h" |
| 8 | 8 |
| 9 #include <launch.h> | 9 #include <launch.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 17 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
| 18 #include "base/logging.h" | 19 #include "base/logging.h" |
| 19 #include "base/mac/foundation_util.h" | 20 #include "base/mac/foundation_util.h" |
| 20 #include "base/mac/launchd.h" | 21 #include "base/mac/launchd.h" |
| 21 #include "base/mac/mac_logging.h" | 22 #include "base/mac/mac_logging.h" |
| 22 #include "base/mac/mac_util.h" | 23 #include "base/mac/mac_util.h" |
| 23 #include "base/mac/scoped_launch_data.h" | 24 #include "base/mac/scoped_launch_data.h" |
| 24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 kCFCompareEqualTo) { | 169 kCFCompareEqualTo) { |
| 169 result = DaemonController::RESULT_OK; | 170 result = DaemonController::RESULT_OK; |
| 170 } else if (CFStringCompare(name, CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 0) == | 171 } else if (CFStringCompare(name, CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 0) == |
| 171 kCFCompareEqualTo) { | 172 kCFCompareEqualTo) { |
| 172 result = DaemonController::RESULT_FAILED; | 173 result = DaemonController::RESULT_FAILED; |
| 173 } else { | 174 } else { |
| 174 LOG(WARNING) << "Ignoring unexpected notification: " << name; | 175 LOG(WARNING) << "Ignoring unexpected notification: " << name; |
| 175 return; | 176 return; |
| 176 } | 177 } |
| 177 | 178 |
| 179 DeregisterForPreferencePaneNotifications(); |
| 180 |
| 178 DCHECK(!current_callback_.is_null()); | 181 DCHECK(!current_callback_.is_null()); |
| 179 DaemonController::CompletionCallback done = current_callback_; | 182 base::ResetAndReturn(¤t_callback_).Run(result); |
| 180 current_callback_.Reset(); | |
| 181 done.Run(result); | |
| 182 | |
| 183 DeregisterForPreferencePaneNotifications(); | |
| 184 } | 183 } |
| 185 | 184 |
| 186 // static | 185 // static |
| 187 bool DaemonControllerDelegateMac::DoShowPreferencePane( | 186 bool DaemonControllerDelegateMac::DoShowPreferencePane( |
| 188 const std::string& config_data) { | 187 const std::string& config_data) { |
| 189 if (!config_data.empty()) { | 188 if (!config_data.empty()) { |
| 190 base::FilePath config_path; | 189 base::FilePath config_path; |
| 191 if (!base::GetTempDir(&config_path)) { | 190 if (!base::GetTempDir(&config_path)) { |
| 192 LOG(ERROR) << "Failed to get filename for saving configuration data."; | 191 LOG(ERROR) << "Failed to get filename for saving configuration data."; |
| 193 return false; | 192 return false; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 self->PreferencePaneCallbackDelegate(name); | 249 self->PreferencePaneCallbackDelegate(name); |
| 251 } | 250 } |
| 252 | 251 |
| 253 scoped_refptr<DaemonController> DaemonController::Create() { | 252 scoped_refptr<DaemonController> DaemonController::Create() { |
| 254 scoped_ptr<DaemonController::Delegate> delegate( | 253 scoped_ptr<DaemonController::Delegate> delegate( |
| 255 new DaemonControllerDelegateMac()); | 254 new DaemonControllerDelegateMac()); |
| 256 return new DaemonController(delegate.Pass()); | 255 return new DaemonController(delegate.Pass()); |
| 257 } | 256 } |
| 258 | 257 |
| 259 } // namespace remoting | 258 } // namespace remoting |
| OLD | NEW |