Chromium Code Reviews| Index: chrome/browser/mac/relauncher.cc |
| =================================================================== |
| --- chrome/browser/mac/relauncher.cc (revision 90648) |
| +++ chrome/browser/mac/relauncher.cc (working copy) |
| @@ -26,6 +26,7 @@ |
| #include "base/process_util.h" |
| #include "base/stringprintf.h" |
| #include "base/sys_string_conversions.h" |
| +#include "chrome/browser/mac/install_from_dmg.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "content/common/content_paths.h" |
| #include "content/common/content_switches.h" |
| @@ -42,6 +43,8 @@ |
| namespace mac_relauncher { |
| +const char* const kRelauncherDMGArg = "--dmg="; |
| + |
| namespace { |
| // The "magic" file descriptor that the relauncher process' write side of the |
| @@ -91,10 +94,12 @@ |
| return false; |
| } |
| - return RelaunchAppWithHelper(child_path.value(), args); |
| + std::vector<std::string> relauncher_args; |
| + return RelaunchAppWithHelper(child_path.value(), relauncher_args, args); |
| } |
| bool RelaunchAppWithHelper(const std::string& helper, |
| + const std::vector<std::string>& relauncher_args, |
| const std::vector<std::string>& args) { |
| std::vector<std::string> relaunch_args; |
| relaunch_args.push_back(helper); |
| @@ -106,6 +111,9 @@ |
| relaunch_args.push_back(kRelauncherBackgroundArg); |
| } |
| + relaunch_args.insert(relaunch_args.end(), |
| + relauncher_args.begin(), relauncher_args.end()); |
| + |
| relaunch_args.push_back(kRelauncherArgSeparator); |
| // When using the CommandLine interface, -psn_ may have been rewritten as |
| @@ -295,6 +303,7 @@ |
| // start it in the background. |
| bool background = false; |
| bool in_relaunch_args = false; |
| + std::string dmg_bsd_device_name; |
| bool seen_relaunch_executable = false; |
| std::string relaunch_executable; |
| const std::string relauncher_arg_separator(kRelauncherArgSeparator); |
| @@ -311,6 +320,9 @@ |
| in_relaunch_args = true; |
| } else if (arg == kRelauncherBackgroundArg) { |
| background = true; |
| + } else if (arg.compare(0, strlen(kRelauncherDMGArg), |
| + kRelauncherDMGArg) == 0) { |
| + dmg_bsd_device_name.assign(arg.substr(strlen(kRelauncherDMGArg))); |
| } |
| } else { |
| if (!seen_relaunch_executable) { |
| @@ -360,6 +372,14 @@ |
| return 1; |
| } |
| + // The application should have relaunched (or is in the process of |
| + // relaunching.) From this point on, only clean-up tasks should occur, and |
|
Avi (use Gerrit)
2011/06/27 23:28:09
Period outside of the parentheses.
|
| + // failures are tolerable. |
| + |
| + if (!dmg_bsd_device_name.empty()) { |
| + EjectAndTrashDiskImage(dmg_bsd_device_name); |
| + } |
| + |
| return 0; |
| } |