| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 err = OSAExecute(component, script_id, kOSANullScript, kOSAModeCanInteract, | 186 err = OSAExecute(component, script_id, kOSANullScript, kOSAModeCanInteract, |
| 187 &result_id); | 187 &result_id); |
| 188 | 188 |
| 189 if (err == errOSAScriptError) { | 189 if (err == errOSAScriptError) { |
| 190 LOG(LS_ERROR) << "Error when executing Apple Script: " << script; | 190 LOG(LS_ERROR) << "Error when executing Apple Script: " << script; |
| 191 AECreateDesc(typeNull, NULL, 0, &result_data); | 191 AECreateDesc(typeNull, NULL, 0, &result_data); |
| 192 OSAScriptError(component, kOSAErrorMessage, typeChar, &result_data); | 192 OSAScriptError(component, kOSAErrorMessage, typeChar, &result_data); |
| 193 int len = AEGetDescDataSize(&result_data); | 193 int len = AEGetDescDataSize(&result_data); |
| 194 char* data = (char*) malloc(len); | 194 char* data = (char*)malloc(len); |
| 195 if (data != NULL) { | 195 if (data != NULL) { |
| 196 err = AEGetDescData(&result_data, data, len); | 196 err = AEGetDescData(&result_data, data, len); |
| 197 LOG(LS_ERROR) << "Script error: " << data; | 197 LOG(LS_ERROR) << "Script error: " << std::string(data, len); |
| 198 } | 198 } |
| 199 AEDisposeDesc(&script_desc); | 199 AEDisposeDesc(&script_desc); |
| 200 AEDisposeDesc(&result_data); | 200 AEDisposeDesc(&result_data); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 AEDisposeDesc(&script_desc); | 203 AEDisposeDesc(&script_desc); |
| 204 if (script_id != kOSANullScript) { | 204 if (script_id != kOSANullScript) { |
| 205 OSADispose(component, script_id); | 205 OSADispose(component, script_id); |
| 206 } | 206 } |
| 207 if (result_id != kOSANullScript) { | 207 if (result_id != kOSANullScript) { |
| 208 OSADispose(component, result_id); | 208 OSADispose(component, result_id); |
| 209 } | 209 } |
| 210 CloseComponent(component); | 210 CloseComponent(component); |
| 211 return true; | 211 return true; |
| 212 #else | 212 #else |
| 213 // TODO(thaloun): Support applescripts with the NSAppleScript API. | 213 // TODO(thaloun): Support applescripts with the NSAppleScript API. |
| 214 return false; | 214 return false; |
| 215 #endif // CARBON_DEPRECATED | 215 #endif // CARBON_DEPRECATED |
| 216 } | 216 } |
| 217 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) | 217 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) |
| 218 | 218 |
| 219 /////////////////////////////////////////////////////////////////////////////// | 219 /////////////////////////////////////////////////////////////////////////////// |
| 220 | 220 |
| 221 } // namespace rtc | 221 } // namespace rtc |
| OLD | NEW |