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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 7610009: If no locale data files can be found, show a dialog and exit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win compile Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.h ('k') | chrome/browser/browser_main_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 local_state->GetBoolean(prefs::kMetricsReportingEnabled); 824 local_state->GetBoolean(prefs::kMetricsReportingEnabled);
825 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) 825 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable())
826 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; 826 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
827 #endif // #if defined(OS_CHROMEOS) 827 #endif // #if defined(OS_CHROMEOS)
828 return breakpad_enabled; 828 return breakpad_enabled;
829 } 829 }
830 #endif // #if defined(USE_LINUX_BREAKPAD) 830 #endif // #if defined(USE_LINUX_BREAKPAD)
831 831
832 } // namespace 832 } // namespace
833 833
834 namespace chrome_browser {
835 // This error message is not localized because we failed to load the
836 // localization data files.
837 const char kMissingLocaleDataTitle[] = "Missing File Error";
838 const char kMissingLocaleDataMessage[] =
839 "Unable to find locale data files. Please reinstall.";
840 } // namespace chrome_browser
841
834 // BrowserMainParts ------------------------------------------------------------ 842 // BrowserMainParts ------------------------------------------------------------
835 843
836 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) 844 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
837 : parameters_(parameters), 845 : parameters_(parameters),
838 parsed_command_line_(parameters.command_line_) { 846 parsed_command_line_(parameters.command_line_) {
839 } 847 }
840 848
841 BrowserMainParts::~BrowserMainParts() { 849 BrowserMainParts::~BrowserMainParts() {
842 } 850 }
843 851
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 // anything since it comes from Cocoa. 1441 // anything since it comes from Cocoa.
1434 #if defined(OS_MACOSX) 1442 #if defined(OS_MACOSX)
1435 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride()); 1443 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride());
1436 #else 1444 #else
1437 const std::string locale = 1445 const std::string locale =
1438 local_state->GetString(prefs::kApplicationLocale); 1446 local_state->GetString(prefs::kApplicationLocale);
1439 // On a POSIX OS other than ChromeOS, the parameter that is passed to the 1447 // On a POSIX OS other than ChromeOS, the parameter that is passed to the
1440 // method InitSharedInstance is ignored. 1448 // method InitSharedInstance is ignored.
1441 const std::string loaded_locale = 1449 const std::string loaded_locale =
1442 ResourceBundle::InitSharedInstance(locale); 1450 ResourceBundle::InitSharedInstance(locale);
1451 if (loaded_locale.empty() &&
1452 !parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) {
1453 ShowMissingLocaleMessageBox();
1454 return chrome::RESULT_CODE_MISSING_DATA;
1455 }
1443 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; 1456 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
1444 g_browser_process->SetApplicationLocale(loaded_locale); 1457 g_browser_process->SetApplicationLocale(loaded_locale);
1445 1458
1446 FilePath resources_pack_path; 1459 FilePath resources_pack_path;
1447 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 1460 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
1448 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 1461 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
1449 #endif // defined(OS_MACOSX) 1462 #endif // defined(OS_MACOSX)
1450 } 1463 }
1451 1464
1452 #if defined(TOOLKIT_GTK) 1465 #if defined(TOOLKIT_GTK)
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 // (environment variable is set, and valid). 2170 // (environment variable is set, and valid).
2158 std::string pre_read; 2171 std::string pre_read;
2159 if (env->GetVar(kEnvVar, &pre_read) && (pre_read == "0" || pre_read == "1")) { 2172 if (env->GetVar(kEnvVar, &pre_read) && (pre_read == "0" || pre_read == "1")) {
2160 std::string uma_name(name); 2173 std::string uma_name(name);
2161 uma_name += "_PreRead"; 2174 uma_name += "_PreRead";
2162 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 2175 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
2163 AddPreReadHistogramTime(uma_name.c_str(), time); 2176 AddPreReadHistogramTime(uma_name.c_str(), time);
2164 } 2177 }
2165 #endif 2178 #endif
2166 } 2179 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.h ('k') | chrome/browser/browser_main_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698