diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 21:40:59 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 21:40:59 +0000 |
commit | cbce4724553752fa8572f0ac43d2b48e74c6ac79 (patch) | |
tree | 50f1586f3ed213bd0d6aade5987ea87db4cba8df /chrome/browser | |
parent | 939c013a8a01da8bd361d63d0fe122d41ed97744 (diff) | |
download | chromium_src-cbce4724553752fa8572f0ac43d2b48e74c6ac79.zip chromium_src-cbce4724553752fa8572f0ac43d2b48e74c6ac79.tar.gz chromium_src-cbce4724553752fa8572f0ac43d2b48e74c6ac79.tar.bz2 |
If no locale data files can be found, show a dialog and exit
with RESULT_CODE_MISSING_DATA. We used to just CHECK() crash.
BUG=69194
Review URL: http://codereview.chromium.org/7610009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_main.cc | 13 | ||||
-rw-r--r-- | chrome/browser/browser_main.h | 9 | ||||
-rw-r--r-- | chrome/browser/browser_main_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/browser_main_mac.mm | 4 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.cc | 6 |
5 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 5da1a31..d47d3ca 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -831,6 +831,14 @@ bool IsCrashReportingEnabled(const PrefService* local_state) { } // namespace +namespace chrome_browser { +// This error message is not localized because we failed to load the +// localization data files. +const char kMissingLocaleDataTitle[] = "Missing File Error"; +const char kMissingLocaleDataMessage[] = + "Unable to find locale data files. Please reinstall."; +} // namespace chrome_browser + // BrowserMainParts ------------------------------------------------------------ BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) @@ -1440,6 +1448,11 @@ int BrowserMain(const MainFunctionParams& parameters) { // method InitSharedInstance is ignored. const std::string loaded_locale = ResourceBundle::InitSharedInstance(locale); + if (loaded_locale.empty() && + !parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) { + ShowMissingLocaleMessageBox(); + return chrome::RESULT_CODE_MISSING_DATA; + } CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; g_browser_process->SetApplicationLocale(loaded_locale); diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index 80b9602..a663a39 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -30,6 +30,12 @@ namespace net { class NetworkChangeNotifier; } +namespace chrome_browser { +// For use by ShowMissingLocaleMessageBox. +extern const char kMissingLocaleDataTitle[]; +extern const char kMissingLocaleDataMessage[]; +} + // BrowserMainParts: // This class contains different "stages" to be executed in |BrowserMain()|, // mostly initialization. This is made into a class rather than just functions @@ -201,6 +207,9 @@ void RecordBreakpadStatusUMA(MetricsService* metrics); // present on the current platform. void WarnAboutMinimumSystemRequirements(); +// Displays a warning message that we can't find any locale data files. +void ShowMissingLocaleMessageBox(); + // Records the time from our process' startup to the present time in // the UMA histogram |metric_name|. void RecordBrowserStartupTime(); diff --git a/chrome/browser/browser_main_gtk.cc b/chrome/browser/browser_main_gtk.cc index 98480e0..7e718c2 100644 --- a/chrome/browser/browser_main_gtk.cc +++ b/chrome/browser/browser_main_gtk.cc @@ -179,6 +179,22 @@ void WarnAboutMinimumSystemRequirements() { // Nothing to warn about on GTK right now. } +void ShowMissingLocaleMessageBox() { + GtkWidget* dialog = gtk_message_dialog_new( + NULL, + static_cast<GtkDialogFlags>(0), + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "%s", + chrome_browser::kMissingLocaleDataMessage); + + gtk_window_set_title(GTK_WINDOW(dialog), + chrome_browser::kMissingLocaleDataTitle); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + void RecordBrowserStartupTime() { // Not implemented on GTK for now. } diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm index 4e91371..da805df 100644 --- a/chrome/browser/browser_main_mac.mm +++ b/chrome/browser/browser_main_mac.mm @@ -45,6 +45,10 @@ void WarnAboutMinimumSystemRequirements() { // Nothing to check for on Mac right now. } +void ShowMissingLocaleMessageBox() { + // Not called on Mac because we load the locale files differently. +} + // From browser_main_win.h, stubs until we figure out the right thing... int DoUninstallTasks(bool chrome_still_running) { diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index 55714f7..0d1306e 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -83,6 +83,12 @@ void WarnAboutMinimumSystemRequirements() { } } +void ShowMissingLocaleMessageBox() { + ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), + ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), + MB_OK | MB_ICONERROR | MB_TOPMOST); +} + void RecordBrowserStartupTime() { // Calculate the time that has elapsed from our own process creation. FILETIME creation_time = {}; |