summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 22:18:57 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 22:18:57 +0000
commit74d1eecc72f97cb759ea252d8838f5ee46670938 (patch)
tree0de991eb6f83c7390d4a72c6b467a2ed9dd3582d
parentef9fc5845fa7e3d2e9b601bfae60805b8f1c3b89 (diff)
downloadchromium_src-74d1eecc72f97cb759ea252d8838f5ee46670938.zip
chromium_src-74d1eecc72f97cb759ea252d8838f5ee46670938.tar.gz
chromium_src-74d1eecc72f97cb759ea252d8838f5ee46670938.tar.bz2
Continue to remove CHROME_FRAME_BUILD define from code that goes into chrome.dll. This reworks the browser distribution code to use the ChromeFrameBrowserDistribution iff --chrome-frame is present on the command line.
Also, * At startup, chrome.exe now uses the BrowserDistribution code to determine where the Chromium version key resides (instead of hard coding it). * The installer now propagates the presence of --verbose-logging to uninstalls. * The chrome_launcher now allows the --chrome-frame switch through to chrome. * The installer now accepts a --chrome-frame switch. * Remove almost all occurences of the CHROME_FRAME_BUILD define from the installer. BUG=26012, 26603 TEST=Chrome Frame still builds and runs correctly. Chrome Frame builds built without 'branding'='Chrome' now install correctly. Review URL: http://codereview.chromium.org/345021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31015 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/client_util.cc4
-rw-r--r--chrome/browser/first_run_win.cc10
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc3
-rw-r--r--chrome/browser/sandbox_policy.cc7
-rw-r--r--chrome/browser/utility_process_host.cc6
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/installer/setup/install.cc70
-rw-r--r--chrome/installer/setup/setup_main.cc22
-rw-r--r--chrome/installer/setup/uninstall.cc56
-rw-r--r--chrome/installer/util/browser_distribution.cc24
-rw-r--r--chrome/installer/util/browser_distribution.h2
-rw-r--r--chrome/installer/util/install_util.cc9
-rw-r--r--chrome/installer/util/install_util.h4
-rw-r--r--chrome/installer/util/shell_util.cc7
-rw-r--r--chrome/installer/util/util_constants.cc3
-rw-r--r--chrome/installer/util/util_constants.h1
-rw-r--r--chrome_frame/chrome_frame_automation.cc9
-rw-r--r--chrome_frame/chrome_launcher.cc1
-rw-r--r--chrome_frame/chrome_tab.cc2
20 files changed, 164 insertions, 81 deletions
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
index 7fb49ca..d9b53a4 100644
--- a/chrome/app/client_util.cc
+++ b/chrome/app/client_util.cc
@@ -8,6 +8,7 @@
#include "chrome/app/breakpad_win.h"
#include "chrome/app/client_util.h"
#include "chrome/common/result_codes.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/util_constants.h"
@@ -189,7 +190,8 @@ class ChromeDllLoader : public MainDllLoader {
class ChromiumDllLoader : public MainDllLoader {
public:
virtual std::wstring GetRegistryPath() {
- return L"Software\\Chromium";
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ return dist->GetVersionKey();
}
};
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 6514d872..8277c78 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -120,6 +120,12 @@ bool LaunchSetupWithParam(const std::string& param, const std::wstring& value,
base::ProcessHandle ph;
CommandLine cl(exe_path);
cl.AppendSwitchWithValue(param, value);
+
+ CommandLine* browser_command_line = CommandLine::ForCurrentProcess();
+ if (browser_command_line->HasSwitch(switches::kChromeFrame)) {
+ cl.AppendSwitch(switches::kChromeFrame);
+ }
+
if (!base::LaunchApp(cl, false, false, &ph))
return false;
DWORD wr = ::WaitForSingleObject(ph, INFINITE);
@@ -581,6 +587,10 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
import_cmd.CommandLine::AppendSwitchWithValue(switches::kImport,
EncodeImportParams(browser_type, items_to_import, parent_window));
+ if (cmdline.HasSwitch(switches::kChromeFrame)) {
+ import_cmd.AppendSwitch(switches::kChromeFrame);
+ }
+
// Time to launch the process that is going to do the import.
base::ProcessHandle import_process;
if (!base::LaunchApp(import_cmd, false, false, &import_process))
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 2d58f8b..7869759 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -525,6 +525,9 @@ void BrowserRenderProcessHost::PropogateBrowserCommandLineToRenderer(
switches::kDisableByteRangeSupport,
switches::kEnableWebSockets,
switches::kEnableDesktopNotifications,
+ // We propagate the Chrome Frame command line here as well in case the
+ // renderer is not run in the sandbox.
+ switches::kChromeFrame,
#if defined(OS_MACOSX)
// Allow this to be set when invoking the browser and relayed along.
switches::kEnableSandboxLogging,
diff --git a/chrome/browser/sandbox_policy.cc b/chrome/browser/sandbox_policy.cc
index 3c825b0..0acd91d 100644
--- a/chrome/browser/sandbox_policy.cc
+++ b/chrome/browser/sandbox_policy.cc
@@ -364,6 +364,13 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
}
#endif
+ // Propagate the Chrome Frame flag to sandboxed processes if present.
+ if (browser_command_line.HasSwitch(switches::kChromeFrame)) {
+ if (!cmd_line->HasSwitch(switches::kChromeFrame)) {
+ cmd_line->AppendSwitch(switches::kChromeFrame);
+ }
+ }
+
bool child_needs_help =
DebugFlags::ProcessDebugFlags(cmd_line, type, in_sandbox);
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index 0ba763b..af35c36 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -97,6 +97,11 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
SetCrashReporterCommandLine(&cmd_line);
+ const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
+ if (browser_command_line.HasSwitch(switches::kChromeFrame)) {
+ cmd_line.AppendSwitch(switches::kChromeFrame);
+ }
+
base::ProcessHandle process;
#if defined(OS_WIN)
if (!UseSandbox()) {
@@ -110,7 +115,6 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
#else
// TODO(port): Sandbox this on Linux/Mac. Also, zygote this to work with
// Linux updating.
- const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
bool has_cmd_prefix = browser_command_line.HasSwitch(
switches::kUtilityCmdPrefix);
if (has_cmd_prefix) {
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 38fbcf4..c38bcfa 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -43,6 +43,10 @@ const char kBrowserCrashTest[] = "crash-test";
// Path to the exe to run for the renderer and plugin subprocesses.
const char kBrowserSubprocessPath[] = "browser-subprocess-path";
+// Run Chrome in Chrome Frame mode. This means that Chrome expects to be run
+// as a dependent process of the Chrome Frame plugin.
+const char kChromeFrame[] = "chrome-frame";
+
// The Country we should use. This is normally obtained from the operating
// system during first run and cached in the preferences afterwards. This is a
// string value, the 2 letter code from ISO 3166-1.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index e649ec4..03864e7 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -28,6 +28,7 @@ extern const char kBookmarkMenu[];
extern const char kBrowserAssertTest[];
extern const char kBrowserCrashTest[];
extern const char kBrowserSubprocessPath[];
+extern const char kChromeFrame[];
extern const char kCountry[];
extern const char kDebugPrint[];
extern const char kDiagnostics[];
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index c7862b4..64fe11e 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -7,6 +7,7 @@
#include "chrome/installer/setup/install.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -85,6 +86,34 @@ void AddInstallerCopyTasks(const std::wstring& exe_path,
}
}
+void AppendUninstallCommandLineFlags(std::wstring* uninstall_cmd_line,
+ bool is_system) {
+ DCHECK(uninstall_cmd_line);
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kUninstall);
+
+ if (InstallUtil::IsChromeFrameProcess()) {
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kForceUninstall);
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kDeleteProfile);
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kChromeFrame);
+ }
+
+ // Propagate the verbose logging switch to uninstalls too.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(installer_util::switches::kVerboseLogging)) {
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kVerboseLogging);
+ }
+
+ if (is_system) {
+ uninstall_cmd_line->append(L" --");
+ uninstall_cmd_line->append(installer_util::switches::kSystemLevel);
+ }
+}
+
// This method adds work items to create (or update) Chrome uninstall entry in
// Control Panel->Add/Remove Programs list.
void AddUninstallShortcutWorkItems(HKEY reg_root,
@@ -98,20 +127,10 @@ void AddUninstallShortcutWorkItems(HKEY reg_root,
new_version));
file_util::AppendToPath(&uninstall_cmd,
file_util::GetFilenameFromPath(exe_path));
- uninstall_cmd.append(L"\" --");
- uninstall_cmd.append(installer_util::switches::kUninstall);
+ uninstall_cmd.append(L"\"");
-#if defined(CHROME_FRAME_BUILD)
- uninstall_cmd.append(L" --");
- uninstall_cmd.append(installer_util::switches::kForceUninstall);
- uninstall_cmd.append(L" --");
- uninstall_cmd.append(installer_util::switches::kDeleteProfile);
-#endif
-
- if (reg_root == HKEY_LOCAL_MACHINE) {
- uninstall_cmd.append(L" --");
- uninstall_cmd.append(installer_util::switches::kSystemLevel);
- }
+ AppendUninstallCommandLineFlags(&uninstall_cmd,
+ reg_root == HKEY_LOCAL_MACHINE);
// Create DisplayName, UninstallString and InstallLocation keys
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
@@ -250,20 +269,9 @@ bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
new_version));
file_util::AppendToPath(&setup_exe,
file_util::GetFilenameFromPath(exe_path));
- std::wstring arguments(L" --");
- arguments.append(installer_util::switches::kUninstall);
-#if defined(CHROME_FRAME_BUILD)
- arguments.append(L" --");
- arguments.append(installer_util::switches::kForceUninstall);
- arguments.append(L" --");
- arguments.append(installer_util::switches::kDeleteProfile);
-#endif
-
- if (system_install) {
- arguments.append(L" --");
- arguments.append(installer_util::switches::kSystemLevel);
- }
+ std::wstring arguments;
+ AppendUninstallCommandLineFlags(&arguments, system_install);
LOG(INFO) << "Creating/updating uninstall link at "
<< uninstall_link.value();
@@ -466,12 +474,12 @@ bool InstallNewVersion(const std::wstring& exe_path,
if (reg_root != HKEY_LOCAL_MACHINE && reg_root != HKEY_CURRENT_USER)
return false;
-#if defined(CHROME_FRAME_BUILD)
- // Make sure that we don't end up deleting installed files on next reboot.
- if (!RemoveFromMovesPendingReboot(install_path.c_str())) {
- LOG(ERROR) << "Error accessing pending moves value.";
+ if (InstallUtil::IsChromeFrameProcess()) {
+ // Make sure that we don't end up deleting installed files on next reboot.
+ if (!RemoveFromMovesPendingReboot(install_path.c_str())) {
+ LOG(ERROR) << "Error accessing pending moves value.";
+ }
}
-#endif
scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList());
// A temp directory that work items need and the actual install directory.
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index ce42a0f..5cce669 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -598,18 +598,18 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
-#if defined(CHROME_FRAME_BUILD)
- if (install_status == installer_util::UNINSTALL_REQUIRES_REBOOT) {
- ShowRebootDialog();
- } else if (parsed_command_line.HasSwitch(
- installer_util::switches::kUninstall)) {
- ::MessageBoxW(NULL,
- installer_util::GetLocalizedString(
- IDS_UNINSTALL_COMPLETE_BASE).c_str(),
- dist->GetApplicationName().c_str(),
- MB_OK);
+ if (InstallUtil::IsChromeFrameProcess()) {
+ if (install_status == installer_util::UNINSTALL_REQUIRES_REBOOT) {
+ ShowRebootDialog();
+ } else if (parsed_command_line.HasSwitch(
+ installer_util::switches::kUninstall)) {
+ ::MessageBoxW(NULL,
+ installer_util::GetLocalizedString(
+ IDS_UNINSTALL_COMPLETE_BASE).c_str(),
+ dist->GetApplicationName().c_str(),
+ MB_OK);
+ }
}
-#endif
if (install_status == installer_util::UNINSTALL_REQUIRES_REBOOT) {
install_status = installer_util::UNINSTALL_SUCCESSFUL;
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 1a99803..0ac0f2f 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -179,12 +179,13 @@ DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
// Obtain the location of the user profile data. Chrome Frame needs to
// build this path manually since it doesn't use the Chrome default dir.
FilePath user_local_state;
-#if defined(CHROME_FRAME_BUILD)
- bool got_local_state =
- chrome::GetChromeFrameUserDataDirectory(&user_local_state);
-#else // if !defined(CHROME_FRAME_BUILD)
- bool got_local_state = chrome::GetDefaultUserDataDirectory(&user_local_state);
-#endif
+ bool got_local_state = false;
+ if (InstallUtil::IsChromeFrameProcess()) {
+ got_local_state =
+ chrome::GetChromeFrameUserDataDirectory(&user_local_state);
+ } else {
+ got_local_state = chrome::GetDefaultUserDataDirectory(&user_local_state);
+ }
// Move the browser's persisted local state
if (got_local_state) {
@@ -204,20 +205,20 @@ DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
LOG(INFO) << "Deleting install path " << install_path;
if (!file_util::Delete(install_path, true)) {
LOG(ERROR) << "Failed to delete folder (1st try): " << install_path;
-#if defined(CHROME_FRAME_BUILD)
- // We don't try killing Chrome processes for Chrome Frame builds since
- // that is unlikely to help. Instead, schedule files for deletion and
- // return a value that will trigger a reboot prompt.
- ScheduleDirectoryForDeletion(install_path.c_str());
- result = DELETE_REQUIRES_REBOOT;
-#else
- // Try closing any running chrome processes and deleting files once again.
- CloseAllChromeProcesses();
- if (!file_util::Delete(install_path, true)) {
- LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path;
- result = DELETE_FAILED;
+ if (InstallUtil::IsChromeFrameProcess()) {
+ // We don't try killing Chrome processes for Chrome Frame builds since
+ // that is unlikely to help. Instead, schedule files for deletion and
+ // return a value that will trigger a reboot prompt.
+ ScheduleDirectoryForDeletion(install_path.c_str());
+ result = DELETE_REQUIRES_REBOOT;
+ } else {
+ // Try closing any running chrome processes and deleting files once again.
+ CloseAllChromeProcesses();
+ if (!file_util::Delete(install_path, true)) {
+ LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path;
+ result = DELETE_FAILED;
+ }
}
-#endif
}
if (delete_profile && got_local_state) {
@@ -225,12 +226,12 @@ DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
if (!file_util::Delete(user_local_state, true)) {
LOG(ERROR) << "Failed to delete user profile dir: "
<< user_local_state.value();
-#if defined(CHROME_FRAME_BUILD)
- ScheduleDirectoryForDeletion(user_local_state.value().c_str());
- result = DELETE_REQUIRES_REBOOT;
-#else
- result = DELETE_FAILED;
-#endif
+ if (InstallUtil::IsChromeFrameProcess()) {
+ ScheduleDirectoryForDeletion(user_local_state.value().c_str());
+ result = DELETE_REQUIRES_REBOOT;
+ } else {
+ result = DELETE_FAILED;
+ }
}
DeleteEmptyParentDir(user_local_state.value());
}
@@ -407,9 +408,8 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
if (force_uninstall) {
// Since --force-uninstall command line option is used, we are going to
// do silent uninstall. Try to close all running Chrome instances.
-#if !defined(CHROME_FRAME_BUILD)
- CloseAllChromeProcesses();
-#endif
+ if (!InstallUtil::IsChromeFrameProcess())
+ CloseAllChromeProcesses();
} else { // no --force-uninstall so lets show some UI dialog boxes.
status = IsChromeActiveOrUserCancelled(system_uninstall);
if (status != installer_util::UNINSTALL_CONFIRMED &&
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 0d1772f..4298a0c 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -9,20 +9,32 @@
#include "chrome/installer/util/browser_distribution.h"
+#include "base/command_line.h"
#include "base/registry.h"
-#include "chrome/installer/util/google_chrome_distribution.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/env_vars.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
+#include "chrome/installer/util/google_chrome_distribution.h"
+#include "chrome/installer/util/install_util.h"
BrowserDistribution* BrowserDistribution::GetDistribution() {
+ return GetDistribution(InstallUtil::IsChromeFrameProcess());
+}
+
+BrowserDistribution* BrowserDistribution::GetDistribution(bool chrome_frame) {
static BrowserDistribution* dist = NULL;
if (dist == NULL) {
-#if defined(CHROME_FRAME_BUILD)
- dist = new ChromeFrameDistribution();
-#elif defined(GOOGLE_CHROME_BUILD)
- dist = new GoogleChromeDistribution();
+ if (chrome_frame) {
+ // TODO(robertshield): Make one of these for Google Chrome vs
+ // non Google Chrome builds?
+ dist = new ChromeFrameDistribution();
+ } else {
+#if defined(GOOGLE_CHROME_BUILD)
+ dist = new GoogleChromeDistribution();
#else
- dist = new BrowserDistribution();
+ dist = new BrowserDistribution();
#endif
+ }
}
return dist;
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 16d04ac..efb30145 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -67,6 +67,8 @@ class BrowserDistribution {
protected:
BrowserDistribution() {}
+ static BrowserDistribution* GetDistribution(bool chrome_frame);
+
private:
DISALLOW_COPY_AND_ASSIGN(BrowserDistribution);
};
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 3551564..c5d3e80 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -12,6 +12,7 @@
#include <algorithm>
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/registry.h"
@@ -22,6 +23,7 @@
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/l10n_string_util.h"
+#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe,
@@ -127,6 +129,13 @@ bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) {
return true;
}
+bool InstallUtil::IsChromeFrameProcess() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ DCHECK(command_line)
+ << "IsChromeFrameProcess() called before ComamandLine::Init()";
+ return command_line->HasSwitch(installer_util::switches::kChromeFrame);
+}
+
bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path,
const wchar_t** const dll_names,
int dll_names_count,
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 2bc5117..3ce4166 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -55,6 +55,10 @@ class InstallUtil {
// Program Files).
static bool IsPerUserInstall(const wchar_t* const exe_path);
+ // Returns true if this is a Chrome Frame installation (as indicated by the
+ // presence of --chrome-frame on the command line).
+ static bool IsChromeFrameProcess();
+
// Adds all DLLs in install_path whose names are given by dll_names to a
// work item list containing registration or unregistration actions.
//
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 6982fa7..d4f5930 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -313,6 +313,13 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
params.append(installer_util::switches::kRegisterChromeBrowserSuffix);
params.append(L"=\"" + suffix + L"\"");
}
+
+ CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
+ if (browser_command_line.HasSwitch(switches::kChromeFrame)) {
+ params.append(L" --");
+ params.append(installer_util::switches::kChromeFrame);
+ }
+
DWORD ret_val = 0;
InstallUtil::ExecuteExeAsAdmin(exe_path, params, &ret_val);
if (ret_val == 0)
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index 4b791dc..046acfe 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -8,6 +8,9 @@ namespace installer_util {
namespace switches {
+// Run the installer in Chrome Frame mode.
+const wchar_t kChromeFrame[] = L"chrome-frame";
+
// Create Desktop and QuickLaunch shortcuts
const wchar_t kCreateAllShortcuts[] = L"create-all-shortcuts";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 61f6805..d10a585 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -44,6 +44,7 @@ enum InstallStatus {
};
namespace switches {
+extern const wchar_t kChromeFrame[];
extern const wchar_t kCreateAllShortcuts[];
extern const wchar_t kDeleteProfile[];
extern const wchar_t kDisableLogging[];
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 13a7339..0cafc87 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -165,8 +165,8 @@ ProxyFactory::ProxyFactory()
ProxyFactory::~ProxyFactory() {
for (size_t i = 0; i < proxies_.container().size(); ++i) {
- if (WAIT_OBJECT_0 !=
- WaitForSingleObject(proxies_[i]->thread->thread_handle(), 0))
+ DWORD result = WaitForSingleObject(proxies_[i]->thread->thread_handle(), 0);
+ if (WAIT_OBJECT_0 != result)
// TODO(stoyan): Don't leak proxies on exit.
DLOG(ERROR) << "Proxies leaked on exit.";
}
@@ -245,6 +245,11 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry,
// to do with an improperly set up profile...
command_line->AppendSwitch(switches::kDisableMetrics);
+ // Run Chrome in Chrome Frame mode. In practice, this modifies the paths
+ // and registry keys that Chrome looks in via the BrowserDistribution
+ // mechanism.
+ command_line->AppendSwitch(switches::kChromeFrame);
+
// Chrome Frame never wants Chrome to start up with a First Run UI.
command_line->AppendSwitch(switches::kNoFirstRun);
diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc
index af35481..731ff04 100644
--- a/chrome_frame/chrome_launcher.cc
+++ b/chrome_frame/chrome_launcher.cc
@@ -21,6 +21,7 @@ const wchar_t kLauncherExeBaseName[] = L"chrome_launcher.exe";
// safe-for-Low-Integrity version of the Chrome command line.
const char* kAllowedSwitches[] = {
switches::kAutomationClientChannelID,
+ switches::kChromeFrame,
switches::kDisableMetrics,
switches::kEnableRendererAccessibility,
switches::kEnableExperimentalExtensionApis,
diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc
index 8c526c4..0c79b03 100644
--- a/chrome_frame/chrome_tab.cc
+++ b/chrome_frame/chrome_tab.cc
@@ -126,9 +126,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance,
ATL::CTrace::s_trace.ChangeCategory(atlTraceRegistrar, 0,
ATLTRACESTATUS_DISABLED);
#endif
+ CommandLine::Init(0, NULL);
InitializeCrashReporting();
g_exit_manager = new base::AtExitManager();
- CommandLine::Init(0, NULL);
logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE);
} else if (reason == DLL_PROCESS_DETACH) {