summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 19:30:03 +0000
committerasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 19:30:03 +0000
commit431b5cd77b2985869e33bf31d7eccd479a2a5372 (patch)
treeee104771f6f3fd3a33087e700e56e41760ec6c14 /chrome
parentbdd67ed94937f5da2fbfec76ed795f0b5998bf77 (diff)
downloadchromium_src-431b5cd77b2985869e33bf31d7eccd479a2a5372.zip
chromium_src-431b5cd77b2985869e33bf31d7eccd479a2a5372.tar.gz
chromium_src-431b5cd77b2985869e33bf31d7eccd479a2a5372.tar.bz2
Suppress critical error dialogs on Windows
BUG=100295 TEST=Manual. Download a file to a USB stick. Disconnect USB stick, restart Chrome and visit chrome://downloads. There should be no "There is no disk in drive..." error and the download should be marked as "Removed." Review URL: http://codereview.chromium.org/9022044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116897 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/chrome_main_delegate.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 5c96e27..abeb5fd 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -182,6 +182,17 @@ void CheckUserDataDirPolicy(FilePath* user_data_dir) {
}
}
+// If we try to access a path that is not currently available, we want the call
+// to fail rather than show an error dialog.
+void SuppressWindowsErrorDialogs() {
+ UINT new_flags = SEM_FAILCRITICALERRORS |
+ SEM_NOOPENFILEERRORBOX;
+
+ // Preserve existing error mode.
+ UINT existing_flags = SetErrorMode(new_flags);
+ SetErrorMode(existing_flags | new_flags);
+}
+
#endif // defined(OS_WIN)
#if defined(OS_LINUX)
@@ -664,6 +675,9 @@ void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
#if defined(OS_LINUX)
AdjustLinuxOOMScore(process_type);
#endif
+#if defined(OS_WIN)
+ SuppressWindowsErrorDialogs();
+#endif
}
int ChromeMainDelegate::RunProcess(