OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_browser_main_win.h" | 5 #include "chrome/browser/chrome_browser_main_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 int GetMinimumFontSize() { | 102 int GetMinimumFontSize() { |
103 int min_font_size; | 103 int min_font_size; |
104 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), | 104 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), |
105 &min_font_size); | 105 &min_font_size); |
106 return min_font_size; | 106 return min_font_size; |
107 } | 107 } |
108 | 108 |
109 class TranslationDelegate : public installer::TranslationDelegate { | 109 class TranslationDelegate : public installer::TranslationDelegate { |
110 public: | 110 public: |
111 virtual base::string16 GetLocalizedString(int installer_string_id) override; | 111 base::string16 GetLocalizedString(int installer_string_id) override; |
112 }; | 112 }; |
113 | 113 |
114 void ExecuteFontCacheBuildTask(const base::FilePath& path) { | 114 void ExecuteFontCacheBuildTask(const base::FilePath& path) { |
115 base::WeakPtr<content::UtilityProcessHost> utility_process_host( | 115 base::WeakPtr<content::UtilityProcessHost> utility_process_host( |
116 content::UtilityProcessHost::Create(NULL, NULL)->AsWeakPtr()); | 116 content::UtilityProcessHost::Create(NULL, NULL)->AsWeakPtr()); |
| 117 utility_process_host->SetName(l10n_util::GetStringUTF16( |
| 118 IDS_UTILITY_PROCESS_FONT_CACHE_BUILDER_NAME)); |
117 utility_process_host->DisableSandbox(); | 119 utility_process_host->DisableSandbox(); |
118 utility_process_host->Send( | 120 utility_process_host->Send( |
119 new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path)); | 121 new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path)); |
120 } | 122 } |
121 | 123 |
122 #if defined(KASKO) | 124 #if defined(KASKO) |
123 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { | 125 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { |
124 DCHECK(!error); | 126 DCHECK(!error); |
125 if (error) | 127 if (error) |
126 return; | 128 return; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 356 |
355 // If the known command-line test options are used we don't create the | 357 // If the known command-line test options are used we don't create the |
356 // environment block which means we don't get the restart dialog. | 358 // environment block which means we don't get the restart dialog. |
357 if (parsed_command_line.HasSwitch(switches::kBrowserCrashTest) || | 359 if (parsed_command_line.HasSwitch(switches::kBrowserCrashTest) || |
358 parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) | 360 parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) |
359 return; | 361 return; |
360 | 362 |
361 // The encoding we use for the info is "title|context|direction" where | 363 // The encoding we use for the info is "title|context|direction" where |
362 // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending | 364 // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending |
363 // on the current locale. | 365 // on the current locale. |
364 base::string16 dlg_strings(l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_TITLE)
); | 366 base::string16 dlg_strings( |
| 367 l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_TITLE)); |
365 dlg_strings.push_back('|'); | 368 dlg_strings.push_back('|'); |
366 base::string16 adjusted_string( | 369 base::string16 adjusted_string( |
367 l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT)); | 370 l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT)); |
368 base::i18n::AdjustStringForLocaleDirection(&adjusted_string); | 371 base::i18n::AdjustStringForLocaleDirection(&adjusted_string); |
369 dlg_strings.append(adjusted_string); | 372 dlg_strings.append(adjusted_string); |
370 dlg_strings.push_back('|'); | 373 dlg_strings.push_back('|'); |
371 dlg_strings.append(base::ASCIIToUTF16( | 374 dlg_strings.append(base::ASCIIToUTF16( |
372 base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); | 375 base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); |
373 | 376 |
374 env->SetVar(env_vars::kRestartInfo, base::UTF16ToUTF8(dlg_strings)); | 377 env->SetVar(env_vars::kRestartInfo, base::UTF16ToUTF8(dlg_strings)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); | 454 base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); |
452 if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { | 455 if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { |
453 bool is_metro = base::win::IsMetroProcess(); | 456 bool is_metro = base::win::IsMetroProcess(); |
454 if (!is_metro) { | 457 if (!is_metro) { |
455 // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on | 458 // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on |
456 // an invisible dialog. | 459 // an invisible dialog. |
457 // TODO (gab): Get rid of this dialog altogether and auto-launch | 460 // TODO (gab): Get rid of this dialog altogether and auto-launch |
458 // system-level Chrome instead. | 461 // system-level Chrome instead. |
459 const base::string16 text = | 462 const base::string16 text = |
460 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 463 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); |
461 const base::string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAM
E); | 464 const base::string16 caption = |
| 465 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
462 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | 466 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; |
463 ui::MessageBox(NULL, text, caption, flags); | 467 ui::MessageBox(NULL, text, caption, flags); |
464 } | 468 } |
465 base::CommandLine uninstall_cmd( | 469 base::CommandLine uninstall_cmd( |
466 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 470 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); |
467 if (!uninstall_cmd.GetProgram().empty()) { | 471 if (!uninstall_cmd.GetProgram().empty()) { |
468 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); | 472 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); |
469 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 473 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
470 uninstall_cmd.AppendSwitch( | 474 uninstall_cmd.AppendSwitch( |
471 installer::switches::kDoNotRemoveSharedItems); | 475 installer::switches::kDoNotRemoveSharedItems); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 if (resource_id) | 524 if (resource_id) |
521 return l10n_util::GetStringUTF16(resource_id); | 525 return l10n_util::GetStringUTF16(resource_id); |
522 return base::string16(); | 526 return base::string16(); |
523 } | 527 } |
524 | 528 |
525 // static | 529 // static |
526 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 530 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
527 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 531 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
528 installer::SetTranslationDelegate(&delegate); | 532 installer::SetTranslationDelegate(&delegate); |
529 } | 533 } |
OLD | NEW |