summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-05 14:17:17 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-05 14:17:17 +0000
commitca8384f71e1afbe25e5bca6793aebc3ea1218e23 (patch)
treee036d63ee25f3c31c8633b5a3c071d9bcd3dbaf3
parentd1d0eb2f35be2b1c664099d8239eb7087d54b86d (diff)
downloadchromium_src-ca8384f71e1afbe25e5bca6793aebc3ea1218e23.zip
chromium_src-ca8384f71e1afbe25e5bca6793aebc3ea1218e23.tar.gz
chromium_src-ca8384f71e1afbe25e5bca6793aebc3ea1218e23.tar.bz2
Change the system-level EULA dialog to not use GET parameters with res:// urls. Instead use the dialogArgument property on the window object. res:// urls with GET parameters don't appear to work with the IE6 version of MSHTML.
BUG=88192 TEST=Install system-level Chrome on a new machine with a master_preferences file that includes "require_eula":true. Observe that a non-blank EULA dialog shows up and that the user can run Chrome. Review URL: http://codereview.chromium.org/7309008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91507 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/installer/setup/eula/oem.js50
-rw-r--r--chrome/installer/setup/setup_main.cc17
-rw-r--r--chrome/installer/util/html_dialog.h6
-rw-r--r--chrome/installer/util/html_dialog_impl.cc44
4 files changed, 61 insertions, 56 deletions
diff --git a/chrome/installer/setup/eula/oem.js b/chrome/installer/setup/eula/oem.js
index 5831b34..e142911 100644
--- a/chrome/installer/setup/eula/oem.js
+++ b/chrome/installer/setup/eula/oem.js
@@ -1,26 +1,26 @@
-function setInnerFrame() {
- var regex = new RegExp("\\?innerframe=\"?([^&#\"]*)\"?");
- var results = regex.exec(window.location.href);
- if(results && results[1])
- document.getElementById('ifr').src = results[1];
-}
-
-function checkAccept(f) {
- if (f.accept.checked) {
- window.returnValue = 6;
- } else {
- window.returnValue = 1;
- }
- window.close();
-}
-
-function resize() {
- var ifr = document.getElementById('ifr');
- var footer = document.getElementById('footer');
-
- ifr.height = footer.offsetTop - ifr.offsetTop;
- setInnerFrame();
-}
-
-window.onresize = resize;
+function setInnerFrame() {
+ var inner_frame = window.dialogArguments;
+ if (inner_frame) {
+ document.getElementById('ifr').src = inner_frame;
+ }
+}
+
+function checkAccept(f) {
+ if (f.accept.checked) {
+ window.returnValue = 6;
+ } else {
+ window.returnValue = 1;
+ }
+ window.close();
+}
+
+function resize() {
+ var ifr = document.getElementById('ifr');
+ var footer = document.getElementById('footer');
+
+ ifr.height = footer.offsetTop - ifr.offsetTop;
+ setInnerFrame();
+}
+
+window.onresize = resize;
window.onload = resize; \ No newline at end of file
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 419017f..7affe54 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -674,17 +674,18 @@ installer::InstallStatus InstallProductsHelper(
installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) :
NULL;
- bool value = false;
+ bool do_not_register_for_update_launch = false;
if (chrome_install) {
prefs.GetBool(
installer::master_preferences::kDoNotRegisterForUpdateLaunch,
- &value);
+ &do_not_register_for_update_launch);
} else {
- value = true; // Never register.
+ do_not_register_for_update_launch = true; // Never register.
}
- bool write_chrome_launch_string = (!value) &&
- (install_status != installer::IN_USE_UPDATED);
+ bool write_chrome_launch_string =
+ (!do_not_register_for_update_launch &&
+ install_status != installer::IN_USE_UPDATED);
installer_state.WriteInstallerResult(install_status, install_msg_base,
write_chrome_launch_string ? &chrome_exe : NULL);
@@ -824,11 +825,7 @@ installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
}
// Newer versions of the caller pass an inner frame parameter that must
// be given to the html page being launched.
- if (!inner_frame.empty()) {
- eula_path += L"?innerframe=";
- eula_path += inner_frame;
- }
- installer::EulaHTMLDialog dlg(eula_path);
+ installer::EulaHTMLDialog dlg(eula_path, inner_frame);
installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal();
if (installer::EulaHTMLDialog::REJECTED == outcome) {
LOG(ERROR) << "EULA rejected or EULA failure";
diff --git a/chrome/installer/util/html_dialog.h b/chrome/installer/util/html_dialog.h
index 80edbba..6ef53f2 100644
--- a/chrome/installer/util/html_dialog.h
+++ b/chrome/installer/util/html_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -70,7 +70,9 @@ HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url);
class EulaHTMLDialog {
public:
// |file| points to an html file on disk or to a resource via res:// spec.
- explicit EulaHTMLDialog(const std::wstring& file);
+ // |param| is a string that will be passed to the dialog as a parameter via
+ // the window.dialogArguments property.
+ EulaHTMLDialog(const std::wstring& file, const std::wstring& param);
~EulaHTMLDialog();
enum Outcome {
diff --git a/chrome/installer/util/html_dialog_impl.cc b/chrome/installer/util/html_dialog_impl.cc
index 96cbc78..0f48041 100644
--- a/chrome/installer/util/html_dialog_impl.cc
+++ b/chrome/installer/util/html_dialog_impl.cc
@@ -1,23 +1,16 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <windows.h>
+#include <mshtmhst.h>
#include <urlmon.h>
+#include "base/win/scoped_variant.h"
#include "chrome/installer/util/html_dialog.h"
#pragma comment(lib, "urlmon.lib")
-namespace {
-// Signature of MSHTML.DLL ShowHTMLDlg.
-typedef HRESULT (CALLBACK *ShowHTMLDlg)(HWND parent_hwnd,
- IMoniker *moniker,
- VARIANT *in_args,
- TCHAR *options,
- VARIANT *out_args);
-} // namespace.
-
namespace installer {
// Windows implementation of the HTML dialog class. The main danger with
@@ -47,7 +40,8 @@ namespace installer {
class HTMLDialogWin : public HTMLDialog {
public:
- explicit HTMLDialogWin(const std::wstring& url) : url_(url) {
+ HTMLDialogWin(const std::wstring& url, const std::wstring& param)
+ : url_(url), param_(param) {
if (!mshtml_)
mshtml_ = LoadLibrary(L"MSHTML.DLL");
}
@@ -70,13 +64,15 @@ class HTMLDialogWin : public HTMLDialog {
static LRESULT CALLBACK MsgFilter(int code, WPARAM wParam, LPARAM lParam);
std::wstring url_;
+ std::wstring param_;
static HHOOK hook_;
static HINSTANCE mshtml_;
static CustomizationCallback* callback_;
};
-HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url) {
- return new HTMLDialogWin(url);
+HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url,
+ const std::wstring& param) {
+ return new HTMLDialogWin(url, param);
}
HHOOK HTMLDialogWin::hook_ = NULL;
@@ -106,13 +102,14 @@ bool HTMLDialogWin::InternalDoDialog(CustomizationCallback* callback,
int* result) {
if (!mshtml_)
return false;
- ShowHTMLDlg show_html_dialog =
- reinterpret_cast<ShowHTMLDlg>(GetProcAddress(mshtml_, "ShowHTMLDialog"));
+ SHOWHTMLDIALOGFN* show_html_dialog =
+ reinterpret_cast<SHOWHTMLDIALOGFN*>(
+ GetProcAddress(mshtml_, "ShowHTMLDialog"));
if (!show_html_dialog)
return false;
IMoniker *url_moniker = NULL;
- ::CreateURLMoniker(NULL, url_.c_str(), &url_moniker);
+ ::CreateURLMonikerEx(NULL, url_.c_str(), &url_moniker, URL_MK_UNIFORM);
if (!url_moniker)
return false;
@@ -126,11 +123,19 @@ bool HTMLDialogWin::InternalDoDialog(CustomizationCallback* callback,
callback_ = callback;
}
+ // Pass our parameter to the dialog in the dialogArguments property of
+ // the window object.
+ base::win::ScopedVariant dialog_args(param_.c_str());
+
VARIANT v_result;
::VariantInit(&v_result);
// Creates the window with the embedded IE control in a modal loop.
- HRESULT hr = show_html_dialog(NULL, url_moniker, NULL, extra_args, &v_result);
+ HRESULT hr = show_html_dialog(NULL,
+ url_moniker,
+ dialog_args.AsInput(),
+ extra_args,
+ &v_result);
url_moniker->Release();
if (v_result.vt == VT_I4)
@@ -163,8 +168,9 @@ void EulaHTMLDialog::Customizer::OnBeforeDisplay(void* window) {
reinterpret_cast<LPARAM>(ico));
}
-EulaHTMLDialog::EulaHTMLDialog(const std::wstring& file) {
- dialog_ = CreateNativeHTMLDialog(file);
+EulaHTMLDialog::EulaHTMLDialog(const std::wstring& file,
+ const std::wstring& param) {
+ dialog_ = CreateNativeHTMLDialog(file, param);
}
EulaHTMLDialog::~EulaHTMLDialog() {