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