summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 06:11:56 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 06:11:56 +0000
commit5e6e939f429310fb37d00421f728ecba11bc030e (patch)
treeb901d98ca174aadc338a728914c1603c5d277f45
parent912c64520e0e9f22bd49e43c7ee102e3b9de66a7 (diff)
downloadchromium_src-5e6e939f429310fb37d00421f728ecba11bc030e.zip
chromium_src-5e6e939f429310fb37d00421f728ecba11bc030e.tar.gz
chromium_src-5e6e939f429310fb37d00421f728ecba11bc030e.tar.bz2
Add a command line argument to disable message boxes. This is useful to
extension developers who want to package extensions as part of a build script and aren't there to click the message box. R=aa,jackson BUG=14732 TEST=Pack an extension with the --no-message-box flag and notice that there is no message box. Review URL: http://codereview.chromium.org/149795 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20937 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/win_util.cc5
-rw-r--r--base/base_switches.cc4
-rw-r--r--base/base_switches.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/app/win_util.cc b/app/win_util.cc
index 70e6ecc..9e54f5c 100644
--- a/app/win_util.cc
+++ b/app/win_util.cc
@@ -13,6 +13,8 @@
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
+#include "base/base_switches.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/gfx/gdi_util.h"
#include "base/gfx/png_encoder.h"
@@ -795,6 +797,9 @@ int MessageBox(HWND hwnd,
const std::wstring& text,
const std::wstring& caption,
UINT flags) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoMessageBox))
+ return IDOK;
+
UINT actual_flags = flags;
if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
actual_flags |= MB_RIGHT | MB_RTLREADING;
diff --git a/base/base_switches.cc b/base/base_switches.cc
index 77d263c..900f217 100644
--- a/base/base_switches.cc
+++ b/base/base_switches.cc
@@ -30,6 +30,10 @@ const wchar_t kProcessType[] = L"type";
// Enable DCHECKs in release mode.
const wchar_t kEnableDCHECK[] = L"enable-dcheck";
+// Disable win_util::MessageBox. This is useful when running as part of
+// scripts that do not have a user interface.
+const wchar_t kNoMessageBox[] = L"no-message-box";
+
// Refuse to make HTTP connections and refuse to accept certificate errors.
// For more information about the design of this feature, please see
//
diff --git a/base/base_switches.h b/base/base_switches.h
index 97a3691..34c0b0ea 100644
--- a/base/base_switches.h
+++ b/base/base_switches.h
@@ -16,6 +16,7 @@ extern const wchar_t kFullMemoryCrashReport[];
extern const wchar_t kNoErrorDialogs[];
extern const wchar_t kProcessType[];
extern const wchar_t kEnableDCHECK[];
+extern const wchar_t kNoMessageBox[];
extern const wchar_t kForceHTTPS[];
} // namespace switches