Remove the \servers build output directory and place Chrome Frame parts into the root output folder next to chrome.exe et al.
Also add a more helpful error message when failing to register the Chrome Frame dll. Review URL: http://codereview.chromium.org/8013001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102780 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome/installer/mini_installer
chrome_frame
@ -40,8 +40,8 @@ icudt.dll: %(VersionDir)s\
|
||||
resources.pak: %(VersionDir)s\
|
||||
locales\*.pak: %(VersionDir)s\Locales
|
||||
locales\*.dll: %(VersionDir)s\Locales
|
||||
servers\*.dll: %(VersionDir)s\
|
||||
servers\*.exe: %(VersionDir)s\
|
||||
npchrome_frame.dll: %(VersionDir)s\
|
||||
chrome_launcher.exe: %(VersionDir)s\
|
||||
chrome_frame_helper.exe: %(VersionDir)s\
|
||||
chrome_frame_helper.dll: %(VersionDir)s\
|
||||
Extensions\*.*: %(VersionDir)s\Extensions\
|
||||
|
@ -64,7 +64,7 @@ void CFProxy::InitInIoThread(const ProxyParams& params) {
|
||||
ipc_sender_ = api_->CreateChannel(channel_id, this);
|
||||
std::wstring cmd_line = BuildCmdLine(channel_id, params.profile_path,
|
||||
params.extra_params);
|
||||
if (api_->LaunchApp(cmd_line)) {
|
||||
if (!cmd_line.empty() && api_->LaunchApp(cmd_line)) {
|
||||
CancelableTask* launch_timeout = NewRunnableMethod(this,
|
||||
&CFProxy::LaunchTimeOut);
|
||||
ipc_thread_.message_loop()->PostDelayedTask(FROM_HERE, launch_timeout,
|
||||
|
@ -275,35 +275,38 @@ std::string GenerateChannelId() {
|
||||
std::wstring BuildCmdLine(const std::string& channel_id,
|
||||
const FilePath& profile_path,
|
||||
const std::wstring& extra_args) {
|
||||
scoped_ptr<CommandLine> command_line(
|
||||
chrome_launcher::CreateLaunchCommandLine());
|
||||
command_line->AppendSwitchASCII(switches::kAutomationClientChannelID,
|
||||
channel_id);
|
||||
// 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);
|
||||
command_line->AppendSwitch(switches::kDisablePopupBlocking);
|
||||
std::wstring command_line_string;
|
||||
scoped_ptr<CommandLine> command_line;
|
||||
if (chrome_launcher::CreateLaunchCommandLine(&command_line)) {
|
||||
command_line->AppendSwitchASCII(switches::kAutomationClientChannelID,
|
||||
channel_id);
|
||||
// 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);
|
||||
command_line->AppendSwitch(switches::kDisablePopupBlocking);
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
|
||||
// useful for Chrome Frame users.
|
||||
command_line->AppendSwitch(switches::kNoErrorDialogs);
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
|
||||
// useful for Chrome Frame users.
|
||||
command_line->AppendSwitch(switches::kNoErrorDialogs);
|
||||
#endif
|
||||
|
||||
// In headless mode runs like reliability test runs we want full crash dumps
|
||||
// from chrome.
|
||||
if (IsHeadlessMode())
|
||||
command_line->AppendSwitch(switches::kFullMemoryCrashReport);
|
||||
// In headless mode runs like reliability test runs we want full crash dumps
|
||||
// from chrome.
|
||||
if (IsHeadlessMode())
|
||||
command_line->AppendSwitch(switches::kFullMemoryCrashReport);
|
||||
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir, profile_path);
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir, profile_path);
|
||||
|
||||
std::wstring command_line_string(command_line->GetCommandLineString());
|
||||
if (!extra_args.empty()) {
|
||||
command_line_string.append(L" ");
|
||||
command_line_string.append(extra_args);
|
||||
command_line_string = command_line->GetCommandLineString();
|
||||
if (!extra_args.empty()) {
|
||||
command_line_string.append(L" ");
|
||||
command_line_string.append(extra_args);
|
||||
}
|
||||
}
|
||||
|
||||
return command_line_string;
|
||||
}
|
||||
|
@ -901,8 +901,6 @@
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'OutputFile':
|
||||
'$(OutDir)\\servers\\$(ProjectName).dll',
|
||||
'DelayLoadDLLs': [],
|
||||
'BaseAddress': '0x33000000',
|
||||
# Set /SUBSYSTEM:WINDOWS (for consistency).
|
||||
|
@ -249,57 +249,60 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params,
|
||||
proxy->set_perform_version_check(params->version_check());
|
||||
|
||||
// Launch browser
|
||||
scoped_ptr<CommandLine> command_line(
|
||||
chrome_launcher::CreateLaunchCommandLine());
|
||||
command_line->AppendSwitchASCII(switches::kAutomationClientChannelID,
|
||||
channel_id);
|
||||
std::wstring command_line_string;
|
||||
scoped_ptr<CommandLine> command_line;
|
||||
if (chrome_launcher::CreateLaunchCommandLine(&command_line)) {
|
||||
command_line->AppendSwitchASCII(switches::kAutomationClientChannelID,
|
||||
channel_id);
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
// Chrome Frame never wants Chrome to start up with a First Run UI.
|
||||
command_line->AppendSwitch(switches::kNoFirstRun);
|
||||
|
||||
command_line->AppendSwitch(switches::kDisablePopupBlocking);
|
||||
command_line->AppendSwitch(switches::kDisablePopupBlocking);
|
||||
|
||||
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
|
||||
// useful for Chrome Frame users.
|
||||
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
|
||||
// useful for Chrome Frame users.
|
||||
#ifndef NDEBUG
|
||||
command_line->AppendSwitch(switches::kNoErrorDialogs);
|
||||
command_line->AppendSwitch(switches::kNoErrorDialogs);
|
||||
#endif
|
||||
|
||||
// In headless mode runs like reliability test runs we want full crash dumps
|
||||
// from chrome.
|
||||
if (IsHeadlessMode())
|
||||
command_line->AppendSwitch(switches::kFullMemoryCrashReport);
|
||||
// In headless mode runs like reliability test runs we want full crash dumps
|
||||
// from chrome.
|
||||
if (IsHeadlessMode())
|
||||
command_line->AppendSwitch(switches::kFullMemoryCrashReport);
|
||||
|
||||
// In accessible mode automation tests expect renderer accessibility to be
|
||||
// enabled in chrome.
|
||||
if (IsAccessibleMode())
|
||||
command_line->AppendSwitch(switches::kForceRendererAccessibility);
|
||||
// In accessible mode automation tests expect renderer accessibility to be
|
||||
// enabled in chrome.
|
||||
if (IsAccessibleMode())
|
||||
command_line->AppendSwitch(switches::kForceRendererAccessibility);
|
||||
|
||||
DVLOG(1) << "Profile path: " << params->profile_path().value();
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir,
|
||||
params->profile_path());
|
||||
DVLOG(1) << "Profile path: " << params->profile_path().value();
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir,
|
||||
params->profile_path());
|
||||
|
||||
// Ensure that Chrome is running the specified version of chrome.dll.
|
||||
command_line->AppendSwitchNative(switches::kChromeVersion,
|
||||
GetCurrentModuleVersion());
|
||||
// Ensure that Chrome is running the specified version of chrome.dll.
|
||||
command_line->AppendSwitchNative(switches::kChromeVersion,
|
||||
GetCurrentModuleVersion());
|
||||
|
||||
if (!params->language().empty())
|
||||
command_line->AppendSwitchNative(switches::kLang, params->language());
|
||||
if (!params->language().empty())
|
||||
command_line->AppendSwitchNative(switches::kLang, params->language());
|
||||
|
||||
std::wstring command_line_string(command_line->GetCommandLineString());
|
||||
// If there are any extra arguments, append them to the command line.
|
||||
if (!params->extra_arguments().empty()) {
|
||||
command_line_string += L' ' + params->extra_arguments();
|
||||
command_line_string = command_line->GetCommandLineString();
|
||||
// If there are any extra arguments, append them to the command line.
|
||||
if (!params->extra_arguments().empty()) {
|
||||
command_line_string += L' ' + params->extra_arguments();
|
||||
}
|
||||
}
|
||||
|
||||
automation_server_launch_start_time_ = base::TimeTicks::Now();
|
||||
|
||||
if (!base::LaunchProcess(command_line_string, base::LaunchOptions(), NULL)) {
|
||||
if (command_line_string.empty() ||
|
||||
!base::LaunchProcess(command_line_string, base::LaunchOptions(), NULL)) {
|
||||
// We have no code for launch failure.
|
||||
launch_result_ = AUTOMATION_LAUNCH_RESULT_INVALID;
|
||||
} else {
|
||||
|
@ -82,8 +82,6 @@
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'OutputFile':
|
||||
'$(OutDir)\\servers\\$(ProjectName).exe',
|
||||
# Set /SUBSYSTEM:WINDOWS since this is not a command-line program.
|
||||
'SubSystem': '2',
|
||||
'AdditionalDependencies': [
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/win/windows_version.h"
|
||||
@ -19,30 +20,31 @@ namespace {
|
||||
|
||||
const char kUpdateCommandFlag[] = "--update-cmd";
|
||||
|
||||
CommandLine* CreateChromeLauncherCommandLine() {
|
||||
// Searches for the path to chrome_launcher.exe. Will return false if this
|
||||
// executable cannot be found, otherwise the command line will be placed in
|
||||
// |command_line|.
|
||||
bool CreateChromeLauncherCommandLine(scoped_ptr<CommandLine>* command_line) {
|
||||
DCHECK(command_line);
|
||||
bool success = false;
|
||||
// The launcher EXE will be in the same directory as the Chrome Frame DLL,
|
||||
// so create a full path to it based on this assumption. Since our unit
|
||||
// tests also use this function, and live in the directory above, we test
|
||||
// existence of the file and try the path that includes the /servers/
|
||||
// directory if needed.
|
||||
// so create a full path to it based on this assumption.
|
||||
FilePath module_path;
|
||||
if (PathService::Get(base::FILE_MODULE, &module_path)) {
|
||||
FilePath current_dir = module_path.DirName();
|
||||
FilePath same_dir_path = current_dir.Append(
|
||||
FilePath chrome_launcher = current_dir.Append(
|
||||
chrome_launcher::kLauncherExeBaseName);
|
||||
if (file_util::PathExists(same_dir_path)) {
|
||||
return new CommandLine(same_dir_path);
|
||||
} else {
|
||||
FilePath servers_path = current_dir.Append(L"servers").Append(
|
||||
chrome_launcher::kLauncherExeBaseName);
|
||||
DCHECK(file_util::PathExists(servers_path)) <<
|
||||
"What module is this? It's not in 'servers' or main output dir.";
|
||||
return new CommandLine(servers_path);
|
||||
if (file_util::PathExists(chrome_launcher)) {
|
||||
command_line->reset(new CommandLine(chrome_launcher));
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
NOTREACHED() << "Could not find " << chrome_launcher::kLauncherExeBaseName
|
||||
<< " in output dir.";
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -51,24 +53,30 @@ namespace chrome_launcher {
|
||||
|
||||
const wchar_t kLauncherExeBaseName[] = L"chrome_launcher.exe";
|
||||
|
||||
CommandLine* CreateUpdateCommandLine(const std::wstring& update_command) {
|
||||
CommandLine* command_line = CreateChromeLauncherCommandLine();
|
||||
bool CreateUpdateCommandLine(const std::wstring& update_command,
|
||||
scoped_ptr<CommandLine>* command_line) {
|
||||
DCHECK(command_line);
|
||||
bool success = false;
|
||||
|
||||
if (command_line) {
|
||||
command_line->AppendArg(kUpdateCommandFlag);
|
||||
command_line->AppendArg(WideToASCII(update_command));
|
||||
if (CreateChromeLauncherCommandLine(command_line)) {
|
||||
(*command_line)->AppendArg(kUpdateCommandFlag);
|
||||
(*command_line)->AppendArg(WideToASCII(update_command));
|
||||
success = true;
|
||||
}
|
||||
|
||||
return command_line;
|
||||
return success;
|
||||
}
|
||||
|
||||
CommandLine* CreateLaunchCommandLine() {
|
||||
bool CreateLaunchCommandLine(scoped_ptr<CommandLine>* command_line) {
|
||||
DCHECK(command_line);
|
||||
|
||||
// Shortcut for OS versions that don't need the integrity broker.
|
||||
if (base::win::GetVersion() < base::win::VERSION_VISTA) {
|
||||
return new CommandLine(GetChromeExecutablePath());
|
||||
command_line->reset(new CommandLine(GetChromeExecutablePath()));
|
||||
return true;
|
||||
}
|
||||
|
||||
return CreateChromeLauncherCommandLine();
|
||||
return CreateChromeLauncherCommandLine(command_line);
|
||||
}
|
||||
|
||||
FilePath GetChromeExecutablePath() {
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
class CommandLine;
|
||||
class FilePath;
|
||||
template <class C> class scoped_ptr;
|
||||
|
||||
namespace chrome_launcher {
|
||||
|
||||
@ -19,15 +20,19 @@ extern const wchar_t kLauncherExeBaseName[];
|
||||
// flags needed before launching.
|
||||
//
|
||||
// The command-line may use the Chrome executable directly, or use an in-between
|
||||
// process if needed for security/elevation purposes. You must delete the
|
||||
// returned command line.
|
||||
CommandLine* CreateLaunchCommandLine();
|
||||
// process if needed for security/elevation purposes.
|
||||
//
|
||||
// On success, returns true and populates command_line, which must be non-NULL,
|
||||
// with the launch command line.
|
||||
bool CreateLaunchCommandLine(scoped_ptr<CommandLine>* command_line);
|
||||
|
||||
// Creates a command line suitable for launching the specified command through
|
||||
// Google Update.
|
||||
//
|
||||
// You must delete the returned command line.
|
||||
CommandLine* CreateUpdateCommandLine(const std::wstring& update_command);
|
||||
// On success, returns true and populates command_line, which must be non-NULL,
|
||||
// with the update command line.
|
||||
bool CreateUpdateCommandLine(const std::wstring& update_command,
|
||||
scoped_ptr<CommandLine>* command_line);
|
||||
|
||||
// Returns the full path to the Chrome executable.
|
||||
FilePath GetChromeExecutablePath();
|
||||
|
@ -59,10 +59,9 @@ HANDLE LaunchCommandDirectly(const std::wstring& command_field) {
|
||||
HANDLE LaunchCommandViaProcessLauncher(const std::wstring& command_field) {
|
||||
HANDLE launched_process = NULL;
|
||||
|
||||
scoped_ptr<CommandLine> command_line(
|
||||
chrome_launcher::CreateUpdateCommandLine(command_field));
|
||||
|
||||
if (command_line != NULL) {
|
||||
scoped_ptr<CommandLine> command_line;
|
||||
if (chrome_launcher::CreateUpdateCommandLine(command_field, &command_line)) {
|
||||
DCHECK(command_line != NULL);
|
||||
base::LaunchOptions options;
|
||||
options.start_hidden = true;
|
||||
base::LaunchProcess(*command_line, options, &launched_process);
|
||||
|
@ -292,8 +292,7 @@ class ChromeFrameStartupTest : public ChromeFramePerfTestBase {
|
||||
|
||||
chrome_dll_ = dir_app_.Append(L"chrome.dll");
|
||||
chrome_exe_ = dir_app_.Append(chrome::kBrowserProcessExecutableName);
|
||||
chrome_frame_dll_ = dir_app_.Append(L"servers");
|
||||
chrome_frame_dll_ = chrome_frame_dll_.Append(kChromeFrameDllName);
|
||||
chrome_frame_dll_ = dir_app_.Append(kChromeFrameDllName);
|
||||
icu_dll_ = dir_app_.Append(L"icudt.dll");
|
||||
avcodec_dll_ = dir_app_.Append(L"avcodec-53.dll");
|
||||
avformat_dll_ = dir_app_.Append(L"avformat-53.dll");
|
||||
|
@ -223,7 +223,6 @@ void ChromeFrameTestWithWebServer::VersionTest(BrowserKind browser,
|
||||
const wchar_t* page) {
|
||||
FilePath plugin_path;
|
||||
PathService::Get(base::DIR_MODULE, &plugin_path);
|
||||
plugin_path = plugin_path.AppendASCII("servers");
|
||||
plugin_path = plugin_path.Append(kChromeFrameDllName);
|
||||
|
||||
static FileVersionInfo* version_info =
|
||||
|
@ -29,8 +29,7 @@ FilePath GetChromeFrameBuildPath() {
|
||||
FilePath build_path;
|
||||
PathService::Get(chrome::DIR_APP, &build_path);
|
||||
|
||||
FilePath dll_path = build_path.Append(L"servers").
|
||||
Append(kChromeFrameDllName);
|
||||
FilePath dll_path = build_path.Append(kChromeFrameDllName);
|
||||
|
||||
if (!file_util::PathExists(dll_path)) {
|
||||
// Well, dang.. try looking in the current directory.
|
||||
@ -45,7 +44,7 @@ FilePath GetChromeFrameBuildPath() {
|
||||
return dll_path;
|
||||
}
|
||||
|
||||
bool ScopedChromeFrameRegistrar::register_chrome_path_provider_ = false;;
|
||||
bool ScopedChromeFrameRegistrar::register_chrome_path_provider_ = false;
|
||||
|
||||
// static
|
||||
void ScopedChromeFrameRegistrar::RegisterDefaults() {
|
||||
@ -53,8 +52,6 @@ void ScopedChromeFrameRegistrar::RegisterDefaults() {
|
||||
chrome::RegisterPathProvider();
|
||||
register_chrome_path_provider_ = true;
|
||||
}
|
||||
FilePath dll_path = GetChromeFrameBuildPath();
|
||||
RegisterAtPath(dll_path.value(), chrome_frame_test::GetTestBedType());
|
||||
}
|
||||
|
||||
// static
|
||||
@ -63,7 +60,8 @@ void ScopedChromeFrameRegistrar::RegisterAtPath(
|
||||
|
||||
ASSERT_FALSE(path.empty());
|
||||
HMODULE dll_handle = LoadLibrary(path.c_str());
|
||||
ASSERT_TRUE(dll_handle != NULL);
|
||||
ASSERT_TRUE(dll_handle != NULL) << "Failed to load " << path
|
||||
<< " , gle = " << GetLastError();
|
||||
|
||||
typedef HRESULT (STDAPICALLTYPE* DllRegisterServerFn)();
|
||||
DllRegisterServerFn register_server = NULL;
|
||||
@ -76,9 +74,14 @@ void ScopedChromeFrameRegistrar::RegisterAtPath(
|
||||
dll_handle, "DllRegisterServer"));
|
||||
}
|
||||
ASSERT_TRUE(register_server != NULL);
|
||||
EXPECT_HRESULT_SUCCEEDED((*register_server)());
|
||||
|
||||
HRESULT reg_result = (*register_server)();
|
||||
ASSERT_TRUE(FreeLibrary(dll_handle));
|
||||
|
||||
// Assert here after the FreeLibrary since otherwise we hit a
|
||||
// multiple AtExitMananger crash for modules that use base.
|
||||
ASSERT_HRESULT_SUCCEEDED(reg_result) << "Failed to register DLL at "
|
||||
<< path
|
||||
<< " , are you running as Admin?";
|
||||
}
|
||||
|
||||
// static
|
||||
|
Reference in New Issue
Block a user