| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "chrome/installer/util/browser_distribution.h" | 50 #include "chrome/installer/util/browser_distribution.h" |
| 51 #include "chrome/installer/util/helper.h" | 51 #include "chrome/installer/util/helper.h" |
| 52 #include "chrome/installer/util/install_util.h" | 52 #include "chrome/installer/util/install_util.h" |
| 53 #include "chrome/installer/util/installer_util_strings.h" | 53 #include "chrome/installer/util/installer_util_strings.h" |
| 54 #include "chrome/installer/util/l10n_string_util.h" | 54 #include "chrome/installer/util/l10n_string_util.h" |
| 55 #include "chrome/installer/util/shell_util.h" | 55 #include "chrome/installer/util/shell_util.h" |
| 56 #include "content/public/browser/browser_thread.h" | 56 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/utility_process_host.h" | 57 #include "content/public/browser/utility_process_host.h" |
| 58 #include "content/public/browser/utility_process_host_client.h" | 58 #include "content/public/browser/utility_process_host_client.h" |
| 59 #include "content/public/common/content_switches.h" | 59 #include "content/public/common/content_switches.h" |
| 60 #include "content/public/common/dwrite_font_platform_win.h" | |
| 61 #include "content/public/common/main_function_params.h" | 60 #include "content/public/common/main_function_params.h" |
| 62 #include "ui/base/cursor/cursor_loader_win.h" | 61 #include "ui/base/cursor/cursor_loader_win.h" |
| 63 #include "ui/base/l10n/l10n_util.h" | 62 #include "ui/base/l10n/l10n_util.h" |
| 64 #include "ui/base/l10n/l10n_util_win.h" | 63 #include "ui/base/l10n/l10n_util_win.h" |
| 65 #include "ui/base/ui_base_switches.h" | 64 #include "ui/base/ui_base_switches.h" |
| 66 #include "ui/base/win/message_box_win.h" | 65 #include "ui/base/win/message_box_win.h" |
| 67 #include "ui/gfx/platform_font_win.h" | 66 #include "ui/gfx/platform_font_win.h" |
| 68 #include "ui/gfx/switches.h" | 67 #include "ui/gfx/switches.h" |
| 69 #include "ui/gfx/win/direct_write.h" | 68 #include "ui/gfx/win/direct_write.h" |
| 70 #include "ui/strings/grit/app_locale_settings.h" | 69 #include "ui/strings/grit/app_locale_settings.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 332 |
| 334 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 333 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
| 335 ui::MessageBox(NULL, | 334 ui::MessageBox(NULL, |
| 336 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 335 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
| 337 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 336 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
| 338 MB_OK | MB_ICONERROR | MB_TOPMOST); | 337 MB_OK | MB_ICONERROR | MB_TOPMOST); |
| 339 } | 338 } |
| 340 | 339 |
| 341 void ChromeBrowserMainPartsWin::PostProfileInit() { | 340 void ChromeBrowserMainPartsWin::PostProfileInit() { |
| 342 ChromeBrowserMainParts::PostProfileInit(); | 341 ChromeBrowserMainParts::PostProfileInit(); |
| 343 | |
| 344 // DirectWrite support is mainly available Windows 7 and up. | |
| 345 if (gfx::win::ShouldUseDirectWrite()) { | |
| 346 base::FilePath path( | |
| 347 profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName)); | |
| 348 // This function will create a read only section if cache file exists | |
| 349 // otherwise it will spawn utility process to build cache file, which will | |
| 350 // be used during next browser start/postprofileinit. | |
| 351 if (!content::LoadFontCache(path)) { | |
| 352 // We delay building of font cache until first startup page loads. | |
| 353 // During first renderer start there are lot of things happening | |
| 354 // simultaneously some of them are: | |
| 355 // - Renderer is going through all font files on the system to create | |
| 356 // a font collection. | |
| 357 // - Renderer loading up startup URL, accessing HTML/JS File cache, | |
| 358 // net activity etc. | |
| 359 // - Extension initialization. | |
| 360 // We delay building of cache mainly to avoid parallel font file | |
| 361 // loading along with Renderer. Some systems have significant number of | |
| 362 // font files which takes long time to process. | |
| 363 // Related information is at http://crbug.com/436195. | |
| 364 const int kBuildFontCacheDelaySec = 30; | |
| 365 content::BrowserThread::PostDelayedTask( | |
| 366 content::BrowserThread::IO, | |
| 367 FROM_HERE, | |
| 368 base::Bind(ExecuteFontCacheBuildTask, path), | |
| 369 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); | |
| 370 } | |
| 371 } | |
| 372 } | 342 } |
| 373 | 343 |
| 374 void ChromeBrowserMainPartsWin::PostBrowserStart() { | 344 void ChromeBrowserMainPartsWin::PostBrowserStart() { |
| 375 ChromeBrowserMainParts::PostBrowserStart(); | 345 ChromeBrowserMainParts::PostBrowserStart(); |
| 376 | 346 |
| 377 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); | 347 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); |
| 378 | 348 |
| 379 // Set up a task to verify installed modules in the current process. | 349 // Set up a task to verify installed modules in the current process. |
| 380 content::BrowserThread::PostAfterStartupTask( | 350 content::BrowserThread::PostAfterStartupTask( |
| 381 FROM_HERE, content::BrowserThread::GetBlockingPool(), | 351 FROM_HERE, content::BrowserThread::GetBlockingPool(), |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 if (resource_id) | 555 if (resource_id) |
| 586 return l10n_util::GetStringUTF16(resource_id); | 556 return l10n_util::GetStringUTF16(resource_id); |
| 587 return base::string16(); | 557 return base::string16(); |
| 588 } | 558 } |
| 589 | 559 |
| 590 // static | 560 // static |
| 591 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 561 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 592 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 562 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 593 installer::SetTranslationDelegate(&delegate); | 563 installer::SetTranslationDelegate(&delegate); |
| 594 } | 564 } |
| OLD | NEW |