| 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 <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "ui/base/ui_base_switches.h" | 64 #include "ui/base/ui_base_switches.h" |
| 65 #include "ui/base/win/message_box_win.h" | 65 #include "ui/base/win/message_box_win.h" |
| 66 #include "ui/gfx/platform_font_win.h" | 66 #include "ui/gfx/platform_font_win.h" |
| 67 #include "ui/gfx/switches.h" | 67 #include "ui/gfx/switches.h" |
| 68 #include "ui/strings/grit/app_locale_settings.h" | 68 #include "ui/strings/grit/app_locale_settings.h" |
| 69 | 69 |
| 70 #if defined(GOOGLE_CHROME_BUILD) | 70 #if defined(GOOGLE_CHROME_BUILD) |
| 71 #include "chrome/browser/google/did_run_updater_win.h" | 71 #include "chrome/browser/google/did_run_updater_win.h" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 #if BUILDFLAG(ENABLE_KASKO) | |
| 75 #include "syzygy/kasko/api/reporter.h" | |
| 76 #endif | |
| 77 | |
| 78 namespace { | 74 namespace { |
| 79 | 75 |
| 80 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( | 76 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( |
| 81 const wchar_t* command_line, | 77 const wchar_t* command_line, |
| 82 DWORD flags); | 78 DWORD flags); |
| 83 | 79 |
| 84 void InitializeWindowProcExceptions() { | 80 void InitializeWindowProcExceptions() { |
| 85 // Get the breakpad pointer from chrome.exe | 81 // Get the breakpad pointer from chrome.exe |
| 86 base::win::WinProcExceptionFilter exception_filter = | 82 base::win::WinProcExceptionFilter exception_filter = |
| 87 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress( | 83 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 101 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), | 97 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), |
| 102 &min_font_size); | 98 &min_font_size); |
| 103 return min_font_size; | 99 return min_font_size; |
| 104 } | 100 } |
| 105 | 101 |
| 106 class TranslationDelegate : public installer::TranslationDelegate { | 102 class TranslationDelegate : public installer::TranslationDelegate { |
| 107 public: | 103 public: |
| 108 base::string16 GetLocalizedString(int installer_string_id) override; | 104 base::string16 GetLocalizedString(int installer_string_id) override; |
| 109 }; | 105 }; |
| 110 | 106 |
| 111 #if BUILDFLAG(ENABLE_KASKO) | |
| 112 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { | |
| 113 DCHECK(!error); | |
| 114 if (error) | |
| 115 return; | |
| 116 base::FileEnumerator enumerator(path, true, base::FileEnumerator::FILES); | |
| 117 for (base::FilePath report_file = enumerator.Next(); !report_file.empty(); | |
| 118 report_file = enumerator.Next()) { | |
| 119 if (report_file.Extension() == | |
| 120 kasko::api::kPermanentFailureMinidumpExtension) { | |
| 121 UMA_HISTOGRAM_BOOLEAN("CrashReport.PermanentUploadFailure", true); | |
| 122 } | |
| 123 bool result = base::DeleteFile(report_file, false); | |
| 124 DCHECK(result); | |
| 125 } | |
| 126 } | |
| 127 | |
| 128 void StartFailedKaskoCrashReportWatcher(base::FilePathWatcher* watcher) { | |
| 129 base::FilePath watcher_data_directory; | |
| 130 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) { | |
| 131 NOTREACHED(); | |
| 132 } else { | |
| 133 base::FilePath permanent_failure_directory = | |
| 134 watcher_data_directory.Append(kPermanentlyFailedReportsSubdir); | |
| 135 if (!watcher->Watch(permanent_failure_directory, true, | |
| 136 base::Bind(&ObserveFailedCrashReportDirectory))) { | |
| 137 NOTREACHED(); | |
| 138 } | |
| 139 | |
| 140 // Call it once to observe any files present prior to the Watch() call. | |
| 141 ObserveFailedCrashReportDirectory(permanent_failure_directory, false); | |
| 142 } | |
| 143 } | |
| 144 #endif // BUILDFLAG(ENABLE_KASKO) | |
| 145 | |
| 146 void DetectFaultTolerantHeap() { | 107 void DetectFaultTolerantHeap() { |
| 147 enum FTHFlags { | 108 enum FTHFlags { |
| 148 FTH_HKLM = 1, | 109 FTH_HKLM = 1, |
| 149 FTH_HKCU = 2, | 110 FTH_HKCU = 2, |
| 150 FTH_ACLAYERS_LOADED = 4, | 111 FTH_ACLAYERS_LOADED = 4, |
| 151 FTH_ACXTRNAL_LOADED = 8, | 112 FTH_ACXTRNAL_LOADED = 8, |
| 152 FTH_FLAGS_COUNT = 16 | 113 FTH_FLAGS_COUNT = 16 |
| 153 }; | 114 }; |
| 154 | 115 |
| 155 // The Fault Tolerant Heap (FTH) is enabled on some customer machines and is | 116 // The Fault Tolerant Heap (FTH) is enabled on some customer machines and is |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 294 |
| 334 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr)); | 295 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr)); |
| 335 | 296 |
| 336 // Set up a task to verify installed modules in the current process. | 297 // Set up a task to verify installed modules in the current process. |
| 337 content::BrowserThread::PostAfterStartupTask( | 298 content::BrowserThread::PostAfterStartupTask( |
| 338 FROM_HERE, content::BrowserThread::GetBlockingPool(), | 299 FROM_HERE, content::BrowserThread::GetBlockingPool(), |
| 339 base::Bind(&VerifyInstallation)); | 300 base::Bind(&VerifyInstallation)); |
| 340 | 301 |
| 341 InitializeChromeElf(); | 302 InitializeChromeElf(); |
| 342 | 303 |
| 343 #if BUILDFLAG(ENABLE_KASKO) | |
| 344 content::BrowserThread::PostDelayedTask( | |
| 345 content::BrowserThread::FILE, FROM_HERE, | |
| 346 base::Bind(&StartFailedKaskoCrashReportWatcher, | |
| 347 base::Unretained(&failed_kasko_crash_report_watcher_)), | |
| 348 base::TimeDelta::FromMinutes(5)); | |
| 349 #endif // BUILDFLAG(ENABLE_KASKO) | |
| 350 | |
| 351 #if defined(GOOGLE_CHROME_BUILD) | |
| 352 did_run_updater_.reset(new DidRunUpdater); | |
| 353 #endif | |
| 354 | |
| 355 // Record UMA data about whether the fault-tolerant heap is enabled. | 304 // Record UMA data about whether the fault-tolerant heap is enabled. |
| 356 // Use a delayed task to minimize the impact on startup time. | 305 // Use a delayed task to minimize the impact on startup time. |
| 357 content::BrowserThread::PostDelayedTask( | 306 content::BrowserThread::PostDelayedTask( |
| 358 content::BrowserThread::UI, | 307 content::BrowserThread::UI, |
| 359 FROM_HERE, | 308 FROM_HERE, |
| 360 base::Bind(&DetectFaultTolerantHeap), | 309 base::Bind(&DetectFaultTolerantHeap), |
| 361 base::TimeDelta::FromMinutes(1)); | 310 base::TimeDelta::FromMinutes(1)); |
| 362 } | 311 } |
| 363 | 312 |
| 364 // static | 313 // static |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (resource_id) | 472 if (resource_id) |
| 524 return l10n_util::GetStringUTF16(resource_id); | 473 return l10n_util::GetStringUTF16(resource_id); |
| 525 return base::string16(); | 474 return base::string16(); |
| 526 } | 475 } |
| 527 | 476 |
| 528 // static | 477 // static |
| 529 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 478 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 530 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 479 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 531 installer::SetTranslationDelegate(&delegate); | 480 installer::SetTranslationDelegate(&delegate); |
| 532 } | 481 } |
| OLD | NEW |