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

Side by Side Diff: chrome/browser/mac/relauncher.cc

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/mac/relauncher.h" 5 #include "chrome/browser/mac/relauncher.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <AvailabilityMacros.h> 8 #include <AvailabilityMacros.h>
9 #include <crt_externs.h> 9 #include <crt_externs.h>
10 #include <dlfcn.h> 10 #include <dlfcn.h>
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 LOG(ERROR) << "relauncher process invoked with unexpected arguments"; 287 LOG(ERROR) << "relauncher process invoked with unexpected arguments";
288 return 1; 288 return 1;
289 } 289 }
290 290
291 RelauncherSynchronizeWithParent(); 291 RelauncherSynchronizeWithParent();
292 292
293 // The capacity for relaunch_args is 4 less than argc, because it 293 // The capacity for relaunch_args is 4 less than argc, because it
294 // won't contain the argv[0] of the relauncher process, the 294 // won't contain the argv[0] of the relauncher process, the
295 // RelauncherTypeArg() at argv[1], kRelauncherArgSeparator, or the 295 // RelauncherTypeArg() at argv[1], kRelauncherArgSeparator, or the
296 // executable path of the process to be launched. 296 // executable path of the process to be launched.
297 base::mac::ScopedCFTypeRef<CFMutableArrayRef> relaunch_args( 297 base::ScopedCFTypeRef<CFMutableArrayRef> relaunch_args(
298 CFArrayCreateMutable(NULL, argc - 4, &kCFTypeArrayCallBacks)); 298 CFArrayCreateMutable(NULL, argc - 4, &kCFTypeArrayCallBacks));
299 if (!relaunch_args) { 299 if (!relaunch_args) {
300 LOG(ERROR) << "CFArrayCreateMutable"; 300 LOG(ERROR) << "CFArrayCreateMutable";
301 return 1; 301 return 1;
302 } 302 }
303 303
304 // Figure out what to execute, what arguments to pass it, and whether to 304 // Figure out what to execute, what arguments to pass it, and whether to
305 // start it in the background. 305 // start it in the background.
306 bool background = false; 306 bool background = false;
307 bool in_relaunch_args = false; 307 bool in_relaunch_args = false;
(...skipping 20 matching lines...) Expand all
328 } 328 }
329 } else { 329 } else {
330 if (!seen_relaunch_executable) { 330 if (!seen_relaunch_executable) {
331 // The first argument after kRelauncherBackgroundArg is the path to 331 // The first argument after kRelauncherBackgroundArg is the path to
332 // the executable file or .app bundle directory. The Launch Services 332 // the executable file or .app bundle directory. The Launch Services
333 // interface wants this separate from the rest of the arguments. In 333 // interface wants this separate from the rest of the arguments. In
334 // the relaunched process, this path will still be visible at argv[0]. 334 // the relaunched process, this path will still be visible at argv[0].
335 relaunch_executable.assign(arg); 335 relaunch_executable.assign(arg);
336 seen_relaunch_executable = true; 336 seen_relaunch_executable = true;
337 } else { 337 } else {
338 base::mac::ScopedCFTypeRef<CFStringRef> arg_cf( 338 base::ScopedCFTypeRef<CFStringRef> arg_cf(
339 base::SysUTF8ToCFStringRef(arg)); 339 base::SysUTF8ToCFStringRef(arg));
340 if (!arg_cf) { 340 if (!arg_cf) {
341 LOG(ERROR) << "base::SysUTF8ToCFStringRef failed for " << arg; 341 LOG(ERROR) << "base::SysUTF8ToCFStringRef failed for " << arg;
342 return 1; 342 return 1;
343 } 343 }
344 CFArrayAppendValue(relaunch_args, arg_cf); 344 CFArrayAppendValue(relaunch_args, arg_cf);
345 } 345 }
346 } 346 }
347 } 347 }
348 348
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (!dmg_bsd_device_name.empty()) { 381 if (!dmg_bsd_device_name.empty()) {
382 EjectAndTrashDiskImage(dmg_bsd_device_name); 382 EjectAndTrashDiskImage(dmg_bsd_device_name);
383 } 383 }
384 384
385 return 0; 385 return 0;
386 } 386 }
387 387
388 } // namespace internal 388 } // namespace internal
389 389
390 } // namespace mac_relauncher 390 } // namespace mac_relauncher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698