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

Unified Diff: chrome/browser/mac/relauncher.cc

Issue 7275009: Install from disk image: eject original disk image volume and trash disk image file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698