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/file_path.h" | 14 #include "base/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/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/threading/sequenced_worker_pool.h" | |
21 #include "base/time.h" | |
22 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
23 #include "base/win/metro.h" | 21 #include "base/win/metro.h" |
24 #include "base/win/text_services_message_filter.h" | 22 #include "base/win/text_services_message_filter.h" |
25 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
26 #include "base/win/wrapped_window_proc.h" | 24 #include "base/win/wrapped_window_proc.h" |
27 #include "chrome/browser/browser_util_win.h" | 25 #include "chrome/browser/browser_util_win.h" |
28 #include "chrome/browser/first_run/first_run.h" | 26 #include "chrome/browser/first_run/first_run.h" |
29 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/metrics_service.h" |
30 #include "chrome/browser/profiles/profile_info_cache.h" | 28 #include "chrome/browser/profiles/profile_info_cache.h" |
31 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 29 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
32 #include "chrome/browser/shell_integration.h" | 30 #include "chrome/browser/shell_integration.h" |
33 #include "chrome/browser/system_monitor/removable_device_notifications_window_wi
n.h" | 31 #include "chrome/browser/system_monitor/removable_device_notifications_window_wi
n.h" |
34 #include "chrome/browser/ui/simple_message_box.h" | 32 #include "chrome/browser/ui/simple_message_box.h" |
35 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 33 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
36 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
37 #include "chrome/common/chrome_result_codes.h" | 35 #include "chrome/common/chrome_result_codes.h" |
38 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/env_vars.h" | 37 #include "chrome/common/env_vars.h" |
40 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 38 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
41 #include "chrome/installer/util/browser_distribution.h" | 39 #include "chrome/installer/util/browser_distribution.h" |
42 #include "chrome/installer/util/helper.h" | 40 #include "chrome/installer/util/helper.h" |
43 #include "chrome/installer/util/install_util.h" | 41 #include "chrome/installer/util/install_util.h" |
44 #include "chrome/installer/util/l10n_string_util.h" | 42 #include "chrome/installer/util/l10n_string_util.h" |
45 #include "chrome/installer/util/shell_util.h" | 43 #include "chrome/installer/util/shell_util.h" |
46 #include "content/public/browser/browser_thread.h" | |
47 #include "content/public/common/main_function_params.h" | 44 #include "content/public/common/main_function_params.h" |
48 #include "grit/app_locale_settings.h" | 45 #include "grit/app_locale_settings.h" |
49 #include "grit/chromium_strings.h" | 46 #include "grit/chromium_strings.h" |
50 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
51 #include "installer_util_strings/installer_util_strings.h" | 48 #include "installer_util_strings/installer_util_strings.h" |
52 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
53 #include "ui/base/l10n/l10n_util_win.h" | 50 #include "ui/base/l10n/l10n_util_win.h" |
54 #include "ui/base/ui_base_switches.h" | 51 #include "ui/base/ui_base_switches.h" |
55 #include "ui/base/win/message_box_win.h" | 52 #include "ui/base/win/message_box_win.h" |
56 #include "ui/gfx/platform_font_win.h" | 53 #include "ui/gfx/platform_font_win.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 220 } |
224 } | 221 } |
225 } | 222 } |
226 | 223 |
227 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { | 224 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |
228 ChromeBrowserMainParts::PreMainMessageLoopRun(); | 225 ChromeBrowserMainParts::PreMainMessageLoopRun(); |
229 | 226 |
230 removable_device_notifications_window_->Init(); | 227 removable_device_notifications_window_->Init(); |
231 } | 228 } |
232 | 229 |
233 void ChromeBrowserMainPartsWin::PreInteractiveFirstRunInit() { | |
234 // Trigger the Active Setup command for system-level Chromes to finish | |
235 // configuring this user's install (e.g. per-user shortcuts). | |
236 // Delay the task slightly to give Chrome launch I/O priority while also | |
237 // making sure shortcuts are created promptly to avoid annoying the user by | |
238 // re-creating shortcuts he previously deleted. | |
239 static const int64 kTiggerActiveSetupDelaySeconds = 5; | |
240 FilePath chrome_exe; | |
241 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | |
242 NOTREACHED(); | |
243 } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { | |
244 content::BrowserThread::GetBlockingPool()->PostDelayedTask( | |
245 FROM_HERE, | |
246 base::Bind(&InstallUtil::TriggerActiveSetupCommand), | |
247 base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); | |
248 } | |
249 | |
250 ChromeBrowserMainParts::PreInteractiveFirstRunInit(); | |
251 } | |
252 | |
253 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 230 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
254 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 231 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
255 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 232 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
256 MB_OK | MB_ICONERROR | MB_TOPMOST); | 233 MB_OK | MB_ICONERROR | MB_TOPMOST); |
257 } | 234 } |
258 | 235 |
259 // static | 236 // static |
260 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 237 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
261 const CommandLine& parsed_command_line) { | 238 const CommandLine& parsed_command_line) { |
262 // Clear this var so child processes don't show the dialog by default. | 239 // Clear this var so child processes don't show the dialog by default. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (resource_id) | 389 if (resource_id) |
413 return l10n_util::GetStringUTF16(resource_id); | 390 return l10n_util::GetStringUTF16(resource_id); |
414 return string16(); | 391 return string16(); |
415 } | 392 } |
416 | 393 |
417 // static | 394 // static |
418 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 395 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
419 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 396 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
420 installer::SetTranslationDelegate(&delegate); | 397 installer::SetTranslationDelegate(&delegate); |
421 } | 398 } |
OLD | NEW |