| 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/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/scoped_native_library.h" | 17 #include "base/scoped_native_library.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/win/metro.h" | 20 #include "base/win/metro.h" |
| 21 #include "base/win/text_services_message_filter.h" |
| 21 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
| 22 #include "base/win/wrapped_window_proc.h" | 23 #include "base/win/wrapped_window_proc.h" |
| 23 #include "chrome/browser/browser_util_win.h" | 24 #include "chrome/browser/browser_util_win.h" |
| 24 #include "chrome/browser/first_run/first_run.h" | 25 #include "chrome/browser/first_run/first_run.h" |
| 25 #include "chrome/browser/media_gallery/media_device_notifications_window_win.h" | 26 #include "chrome/browser/media_gallery/media_device_notifications_window_win.h" |
| 26 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/metrics_service.h" |
| 27 #include "chrome/browser/profiles/profile_info_cache.h" | 28 #include "chrome/browser/profiles/profile_info_cache.h" |
| 28 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 29 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 29 #include "chrome/browser/ui/simple_message_box.h" | 30 #include "chrome/browser/ui/simple_message_box.h" |
| 30 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 31 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 ChromeBrowserMainParts::PreMainMessageLoopStart(); | 183 ChromeBrowserMainParts::PreMainMessageLoopStart(); |
| 183 if (!parameters().ui_task) { | 184 if (!parameters().ui_task) { |
| 184 // Make sure that we know how to handle exceptions from the message loop. | 185 // Make sure that we know how to handle exceptions from the message loop. |
| 185 InitializeWindowProcExceptions(); | 186 InitializeWindowProcExceptions(); |
| 186 } | 187 } |
| 187 media_device_notifications_window_ = | 188 media_device_notifications_window_ = |
| 188 new chrome::MediaDeviceNotificationsWindowWin(); | 189 new chrome::MediaDeviceNotificationsWindowWin(); |
| 189 } | 190 } |
| 190 | 191 |
| 192 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { |
| 193 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 194 |
| 195 if (base::win::IsTsfAwareRequired()) { |
| 196 // Create a TSF message filter for the message loop. MessageLoop takes |
| 197 // ownership of the filter. |
| 198 scoped_ptr<MessageLoopForUI::MessageFilter> tsf_message_filter( |
| 199 new base::win::TextServicesMessageFilter); |
| 200 if (tsf_message_filter->Init()) { |
| 201 MessageLoopForUI::current()->SetMessageFilter( |
| 202 tsf_message_filter.release()); |
| 203 } |
| 204 } |
| 205 } |
| 206 |
| 191 // static | 207 // static |
| 192 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 208 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
| 193 const CommandLine& parsed_command_line) { | 209 const CommandLine& parsed_command_line) { |
| 194 // Clear this var so child processes don't show the dialog by default. | 210 // Clear this var so child processes don't show the dialog by default. |
| 195 scoped_ptr<base::Environment> env(base::Environment::Create()); | 211 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 196 env->UnSetVar(env_vars::kShowRestart); | 212 env->UnSetVar(env_vars::kShowRestart); |
| 197 | 213 |
| 198 // For non-interactive tests we don't restart on crash. | 214 // For non-interactive tests we don't restart on crash. |
| 199 if (env->HasVar(env_vars::kHeadless)) | 215 if (env->HasVar(env_vars::kHeadless)) |
| 200 return; | 216 return; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 if (resource_id) | 356 if (resource_id) |
| 341 return l10n_util::GetStringUTF16(resource_id); | 357 return l10n_util::GetStringUTF16(resource_id); |
| 342 return string16(); | 358 return string16(); |
| 343 } | 359 } |
| 344 | 360 |
| 345 // static | 361 // static |
| 346 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 362 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 347 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 363 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 348 installer::SetTranslationDelegate(&delegate); | 364 installer::SetTranslationDelegate(&delegate); |
| 349 } | 365 } |
| OLD | NEW |