| 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 <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "ui/base/ui_base_switches.h" | 70 #include "ui/base/ui_base_switches.h" |
| 71 #include "ui/base/win/message_box_win.h" | 71 #include "ui/base/win/message_box_win.h" |
| 72 #include "ui/gfx/platform_font_win.h" | 72 #include "ui/gfx/platform_font_win.h" |
| 73 #include "ui/gfx/switches.h" | 73 #include "ui/gfx/switches.h" |
| 74 #include "ui/strings/grit/app_locale_settings.h" | 74 #include "ui/strings/grit/app_locale_settings.h" |
| 75 | 75 |
| 76 #if defined(GOOGLE_CHROME_BUILD) | 76 #if defined(GOOGLE_CHROME_BUILD) |
| 77 #include "chrome/browser/google/did_run_updater_win.h" | 77 #include "chrome/browser/google/did_run_updater_win.h" |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 #if BUILDFLAG(ENABLE_KASKO) | |
| 81 #include "syzygy/kasko/api/reporter.h" | |
| 82 #endif | |
| 83 | |
| 84 namespace { | 80 namespace { |
| 85 | 81 |
| 86 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( | 82 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( |
| 87 const wchar_t* command_line, | 83 const wchar_t* command_line, |
| 88 DWORD flags); | 84 DWORD flags); |
| 89 | 85 |
| 90 void InitializeWindowProcExceptions() { | 86 void InitializeWindowProcExceptions() { |
| 91 // Get the breakpad pointer from chrome.exe | 87 // Get the breakpad pointer from chrome.exe |
| 92 base::win::WinProcExceptionFilter exception_filter = | 88 base::win::WinProcExceptionFilter exception_filter = |
| 93 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress( | 89 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 107 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), | 103 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), |
| 108 &min_font_size); | 104 &min_font_size); |
| 109 return min_font_size; | 105 return min_font_size; |
| 110 } | 106 } |
| 111 | 107 |
| 112 class TranslationDelegate : public installer::TranslationDelegate { | 108 class TranslationDelegate : public installer::TranslationDelegate { |
| 113 public: | 109 public: |
| 114 base::string16 GetLocalizedString(int installer_string_id) override; | 110 base::string16 GetLocalizedString(int installer_string_id) override; |
| 115 }; | 111 }; |
| 116 | 112 |
| 117 #if BUILDFLAG(ENABLE_KASKO) | |
| 118 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { | |
| 119 DCHECK(!error); | |
| 120 if (error) | |
| 121 return; | |
| 122 base::FileEnumerator enumerator(path, true, base::FileEnumerator::FILES); | |
| 123 for (base::FilePath report_file = enumerator.Next(); !report_file.empty(); | |
| 124 report_file = enumerator.Next()) { | |
| 125 if (report_file.Extension() == | |
| 126 kasko::api::kPermanentFailureMinidumpExtension) { | |
| 127 UMA_HISTOGRAM_BOOLEAN("CrashReport.PermanentUploadFailure", true); | |
| 128 } | |
| 129 bool result = base::DeleteFile(report_file, false); | |
| 130 DCHECK(result); | |
| 131 } | |
| 132 } | |
| 133 | |
| 134 void StartFailedKaskoCrashReportWatcher(base::FilePathWatcher* watcher) { | |
| 135 base::FilePath watcher_data_directory; | |
| 136 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) { | |
| 137 NOTREACHED(); | |
| 138 } else { | |
| 139 base::FilePath permanent_failure_directory = | |
| 140 watcher_data_directory.Append(kPermanentlyFailedReportsSubdir); | |
| 141 if (!watcher->Watch(permanent_failure_directory, true, | |
| 142 base::Bind(&ObserveFailedCrashReportDirectory))) { | |
| 143 NOTREACHED(); | |
| 144 } | |
| 145 | |
| 146 // Call it once to observe any files present prior to the Watch() call. | |
| 147 ObserveFailedCrashReportDirectory(permanent_failure_directory, false); | |
| 148 } | |
| 149 } | |
| 150 #endif // BUILDFLAG(ENABLE_KASKO) | |
| 151 | |
| 152 void DetectFaultTolerantHeap() { | 113 void DetectFaultTolerantHeap() { |
| 153 enum FTHFlags { | 114 enum FTHFlags { |
| 154 FTH_HKLM = 1, | 115 FTH_HKLM = 1, |
| 155 FTH_HKCU = 2, | 116 FTH_HKCU = 2, |
| 156 FTH_ACLAYERS_LOADED = 4, | 117 FTH_ACLAYERS_LOADED = 4, |
| 157 FTH_ACXTRNAL_LOADED = 8, | 118 FTH_ACXTRNAL_LOADED = 8, |
| 158 FTH_FLAGS_COUNT = 16 | 119 FTH_FLAGS_COUNT = 16 |
| 159 }; | 120 }; |
| 160 | 121 |
| 161 // The Fault Tolerant Heap (FTH) is enabled on some customer machines and is | 122 // The Fault Tolerant Heap (FTH) is enabled on some customer machines and is |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 360 |
| 400 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr)); | 361 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr)); |
| 401 | 362 |
| 402 // Set up a task to verify installed modules in the current process. | 363 // Set up a task to verify installed modules in the current process. |
| 403 content::BrowserThread::PostAfterStartupTask( | 364 content::BrowserThread::PostAfterStartupTask( |
| 404 FROM_HERE, content::BrowserThread::GetBlockingPool(), | 365 FROM_HERE, content::BrowserThread::GetBlockingPool(), |
| 405 base::Bind(&VerifyInstallation)); | 366 base::Bind(&VerifyInstallation)); |
| 406 | 367 |
| 407 InitializeChromeElf(); | 368 InitializeChromeElf(); |
| 408 | 369 |
| 409 #if BUILDFLAG(ENABLE_KASKO) | |
| 410 content::BrowserThread::PostDelayedTask( | |
| 411 content::BrowserThread::FILE, FROM_HERE, | |
| 412 base::Bind(&StartFailedKaskoCrashReportWatcher, | |
| 413 base::Unretained(&failed_kasko_crash_report_watcher_)), | |
| 414 base::TimeDelta::FromMinutes(5)); | |
| 415 #endif // BUILDFLAG(ENABLE_KASKO) | |
| 416 | |
| 417 #if defined(GOOGLE_CHROME_BUILD) | |
| 418 did_run_updater_.reset(new DidRunUpdater); | |
| 419 #endif | |
| 420 | |
| 421 // Record UMA data about whether the fault-tolerant heap is enabled. | 370 // Record UMA data about whether the fault-tolerant heap is enabled. |
| 422 // Use a delayed task to minimize the impact on startup time. | 371 // Use a delayed task to minimize the impact on startup time. |
| 423 content::BrowserThread::PostDelayedTask( | 372 content::BrowserThread::PostDelayedTask( |
| 424 content::BrowserThread::UI, | 373 content::BrowserThread::UI, |
| 425 FROM_HERE, | 374 FROM_HERE, |
| 426 base::Bind(&DetectFaultTolerantHeap), | 375 base::Bind(&DetectFaultTolerantHeap), |
| 427 base::TimeDelta::FromMinutes(1)); | 376 base::TimeDelta::FromMinutes(1)); |
| 428 } | 377 } |
| 429 | 378 |
| 430 // static | 379 // static |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 if (resource_id) | 538 if (resource_id) |
| 590 return l10n_util::GetStringUTF16(resource_id); | 539 return l10n_util::GetStringUTF16(resource_id); |
| 591 return base::string16(); | 540 return base::string16(); |
| 592 } | 541 } |
| 593 | 542 |
| 594 // static | 543 // static |
| 595 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 544 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 596 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 545 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 597 installer::SetTranslationDelegate(&delegate); | 546 installer::SetTranslationDelegate(&delegate); |
| 598 } | 547 } |
| OLD | NEW |