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> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/environment.h" | 13 #include "base/environment.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/scoped_native_library.h" | 18 #include "base/scoped_native_library.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/win/metro.h" | 21 #include "base/win/metro.h" |
22 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
23 #include "base/win/wrapped_window_proc.h" | 23 #include "base/win/wrapped_window_proc.h" |
24 #include "chrome/browser/browser_util_win.h" | 24 #include "chrome/browser/browser_util_win.h" |
| 25 #include "chrome/browser/install_module_verifier_win.h" |
25 #include "chrome/browser/profiles/profile_info_cache.h" | 26 #include "chrome/browser/profiles/profile_info_cache.h" |
26 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 27 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
27 #include "chrome/browser/shell_integration.h" | 28 #include "chrome/browser/shell_integration.h" |
28 #include "chrome/browser/ui/simple_message_box.h" | 29 #include "chrome/browser/ui/simple_message_box.h" |
29 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 30 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
30 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
31 #include "chrome/common/chrome_result_codes.h" | 32 #include "chrome/common/chrome_result_codes.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
34 #include "chrome/common/env_vars.h" | 35 #include "chrome/common/env_vars.h" |
35 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 36 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
36 #include "chrome/installer/util/browser_distribution.h" | 37 #include "chrome/installer/util/browser_distribution.h" |
37 #include "chrome/installer/util/helper.h" | 38 #include "chrome/installer/util/helper.h" |
38 #include "chrome/installer/util/install_util.h" | 39 #include "chrome/installer/util/install_util.h" |
39 #include "chrome/installer/util/l10n_string_util.h" | 40 #include "chrome/installer/util/l10n_string_util.h" |
40 #include "chrome/installer/util/shell_util.h" | 41 #include "chrome/installer/util/shell_util.h" |
| 42 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/common/main_function_params.h" | 43 #include "content/public/common/main_function_params.h" |
42 #include "grit/app_locale_settings.h" | 44 #include "grit/app_locale_settings.h" |
43 #include "grit/chromium_strings.h" | 45 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 46 #include "grit/generated_resources.h" |
45 #include "installer_util_strings/installer_util_strings.h" | 47 #include "installer_util_strings/installer_util_strings.h" |
46 #include "ui/base/cursor/cursor_loader_win.h" | 48 #include "ui/base/cursor/cursor_loader_win.h" |
47 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
48 #include "ui/base/l10n/l10n_util_win.h" | 50 #include "ui/base/l10n/l10n_util_win.h" |
49 #include "ui/base/ui_base_switches.h" | 51 #include "ui/base/ui_base_switches.h" |
50 #include "ui/base/win/message_box_win.h" | 52 #include "ui/base/win/message_box_win.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 219 |
218 return rv; | 220 return rv; |
219 } | 221 } |
220 | 222 |
221 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 223 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
222 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 224 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
223 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 225 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
224 MB_OK | MB_ICONERROR | MB_TOPMOST); | 226 MB_OK | MB_ICONERROR | MB_TOPMOST); |
225 } | 227 } |
226 | 228 |
| 229 void ChromeBrowserMainPartsWin::PostBrowserStart() { |
| 230 ChromeBrowserMainParts::PostBrowserStart(); |
| 231 |
| 232 // Set up a task to verify installed modules in the current process. Use a |
| 233 // delay to reduce the impact on startup time. |
| 234 content::BrowserThread::GetMessageLoopProxyForThread( |
| 235 content::BrowserThread::UI)->PostDelayedTask( |
| 236 FROM_HERE, |
| 237 base::Bind(&BeginModuleVerification), |
| 238 base::TimeDelta::FromSeconds(45)); |
| 239 } |
| 240 |
227 // static | 241 // static |
228 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 242 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
229 const CommandLine& parsed_command_line) { | 243 const CommandLine& parsed_command_line) { |
230 // Clear this var so child processes don't show the dialog by default. | 244 // Clear this var so child processes don't show the dialog by default. |
231 scoped_ptr<base::Environment> env(base::Environment::Create()); | 245 scoped_ptr<base::Environment> env(base::Environment::Create()); |
232 env->UnSetVar(env_vars::kShowRestart); | 246 env->UnSetVar(env_vars::kShowRestart); |
233 | 247 |
234 // For non-interactive tests we don't restart on crash. | 248 // For non-interactive tests we don't restart on crash. |
235 if (env->HasVar(env_vars::kHeadless)) | 249 if (env->HasVar(env_vars::kHeadless)) |
236 return; | 250 return; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (resource_id) | 407 if (resource_id) |
394 return l10n_util::GetStringUTF16(resource_id); | 408 return l10n_util::GetStringUTF16(resource_id); |
395 return string16(); | 409 return string16(); |
396 } | 410 } |
397 | 411 |
398 // static | 412 // static |
399 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 413 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
400 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 414 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
401 installer::SetTranslationDelegate(&delegate); | 415 installer::SetTranslationDelegate(&delegate); |
402 } | 416 } |
OLD | NEW |