Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: chrome/browser/ui/startup/bad_flags_prompt.cc

Issue 174253002: Initialize chrome::DIR_USER_DATA early on for service processes, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use dynamic_annotations_win64 for common_constants_win64. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.h ('k') | chrome/browser/user_data_dir_extractor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/bad_flags_prompt.cc
diff --git a/chrome/browser/ui/startup/bad_flags_prompt.cc b/chrome/browser/ui/startup/bad_flags_prompt.cc
index a3333e7ca28e2ce7030eb7dafd5e70c279260678..3614113034cc3ec939de959baca57f3edc5367cf 100644
--- a/chrome/browser/ui/startup/bad_flags_prompt.cc
+++ b/chrome/browser/ui/startup/bad_flags_prompt.cc
@@ -5,16 +5,23 @@
#include "chrome/browser/ui/startup/bad_flags_prompt.h"
#include "base/command_line.h"
+#include "base/files/file_path.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/switch_utils.h"
+#include "components/startup_metric_utils/startup_metric_utils.h"
#include "components/translate/core/common/translate_switches.h"
#include "extensions/common/switches.h"
+#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
namespace chrome {
@@ -59,4 +66,35 @@ void ShowBadFlagsPrompt(Browser* browser) {
}
}
+void MaybeShowInvalidUserDataDirWarningDialog() {
+ const base::FilePath& user_data_dir = GetInvalidSpecifiedUserDataDir();
+ if (user_data_dir.empty())
+ return;
+
+ startup_metric_utils::SetNonBrowserUIDisplayed();
+
+ // Ensure the ResourceBundle is initialized for string resource access.
+ bool cleanup_resource_bundle = false;
+ if (!ResourceBundle::HasSharedInstance()) {
+ cleanup_resource_bundle = true;
+ std::string locale = l10n_util::GetApplicationLocale(std::string());
+ const char kUserDataDirDialogFallbackLocale[] = "en-US";
+ if (locale.empty())
+ locale = kUserDataDirDialogFallbackLocale;
+ ResourceBundle::InitSharedInstanceWithLocale(locale, NULL);
+ }
+
+ const base::string16& title =
+ l10n_util::GetStringUTF16(IDS_CANT_WRITE_USER_DIRECTORY_TITLE);
+ const base::string16& message =
+ l10n_util::GetStringFUTF16(IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY,
+ user_data_dir.LossyDisplayName());
+
+ if (cleanup_resource_bundle)
+ ResourceBundle::CleanupSharedInstance();
+
+ // More complex dialogs cannot be shown before the earliest calls here.
+ ShowMessageBox(NULL, title, message, chrome::MESSAGE_BOX_TYPE_WARNING);
+}
+
} // namespace chrome
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.h ('k') | chrome/browser/user_data_dir_extractor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698