| 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/win/metro.h" | 21 #include "base/win/metro.h" |
| 22 #include "base/win/text_services_message_filter.h" | 22 #include "base/win/text_services_message_filter.h" |
| 23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
| 24 #include "base/win/wrapped_window_proc.h" | 24 #include "base/win/wrapped_window_proc.h" |
| 25 #include "chrome/browser/browser_util_win.h" | 25 #include "chrome/browser/browser_util_win.h" |
| 26 #include "chrome/browser/first_run/first_run.h" | 26 #include "chrome/browser/first_run/first_run.h" |
| 27 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/metrics_service.h" |
| 28 #include "chrome/browser/profiles/profile_info_cache.h" | 28 #include "chrome/browser/profiles/profile_info_cache.h" |
| 29 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 29 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 30 #include "chrome/browser/shell_integration.h" | 30 #include "chrome/browser/shell_integration.h" |
| 31 #include "chrome/browser/storage_monitor/removable_device_notifications_window_w
in.h" | 31 #include "chrome/browser/storage_monitor/storage_monitor_win.h" |
| 32 #include "chrome/browser/ui/simple_message_box.h" | 32 #include "chrome/browser/ui/simple_message_box.h" |
| 33 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 33 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
| 34 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
| 35 #include "chrome/common/chrome_result_codes.h" | 35 #include "chrome/common/chrome_result_codes.h" |
| 36 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 37 #include "chrome/common/env_vars.h" | 37 #include "chrome/common/env_vars.h" |
| 38 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 38 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 39 #include "chrome/installer/util/browser_distribution.h" | 39 #include "chrome/installer/util/browser_distribution.h" |
| 40 #include "chrome/installer/util/helper.h" | 40 #include "chrome/installer/util/helper.h" |
| 41 #include "chrome/installer/util/install_util.h" | 41 #include "chrome/installer/util/install_util.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { | 192 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { |
| 193 // installer_util references strings that are normally compiled into | 193 // installer_util references strings that are normally compiled into |
| 194 // setup.exe. In Chrome, these strings are in the locale files. | 194 // setup.exe. In Chrome, these strings are in the locale files. |
| 195 SetupInstallerUtilStrings(); | 195 SetupInstallerUtilStrings(); |
| 196 | 196 |
| 197 ChromeBrowserMainParts::PreMainMessageLoopStart(); | 197 ChromeBrowserMainParts::PreMainMessageLoopStart(); |
| 198 if (!parameters().ui_task) { | 198 if (!parameters().ui_task) { |
| 199 // Make sure that we know how to handle exceptions from the message loop. | 199 // Make sure that we know how to handle exceptions from the message loop. |
| 200 InitializeWindowProcExceptions(); | 200 InitializeWindowProcExceptions(); |
| 201 } | 201 } |
| 202 removable_device_notifications_window_.reset( | 202 storage_monitor_.reset(chrome::StorageMonitorWin::Create()); |
| 203 chrome::RemovableDeviceNotificationsWindowWin::Create()); | |
| 204 } | 203 } |
| 205 | 204 |
| 206 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { | 205 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { |
| 207 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 206 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 208 | 207 |
| 209 if (base::win::IsTSFAwareRequired()) { | 208 if (base::win::IsTSFAwareRequired()) { |
| 210 // Create a TSF message filter for the message loop. MessageLoop takes | 209 // Create a TSF message filter for the message loop. MessageLoop takes |
| 211 // ownership of the filter. | 210 // ownership of the filter. |
| 212 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 211 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
| 213 new base::win::TextServicesMessageFilter); | 212 new base::win::TextServicesMessageFilter); |
| 214 if (tsf_message_filter->Init()) { | 213 if (tsf_message_filter->Init()) { |
| 215 MessageLoopForUI::current()->SetMessageFilter( | 214 MessageLoopForUI::current()->SetMessageFilter( |
| 216 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); | 215 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); |
| 217 } | 216 } |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 | 219 |
| 221 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { | 220 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |
| 222 ChromeBrowserMainParts::PreMainMessageLoopRun(); | 221 ChromeBrowserMainParts::PreMainMessageLoopRun(); |
| 223 | 222 |
| 224 removable_device_notifications_window_->Init(); | 223 storage_monitor_->Init(); |
| 225 } | 224 } |
| 226 | 225 |
| 227 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 226 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
| 228 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 227 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
| 229 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 228 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
| 230 MB_OK | MB_ICONERROR | MB_TOPMOST); | 229 MB_OK | MB_ICONERROR | MB_TOPMOST); |
| 231 } | 230 } |
| 232 | 231 |
| 233 // static | 232 // static |
| 234 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 233 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 if (resource_id) | 398 if (resource_id) |
| 400 return l10n_util::GetStringUTF16(resource_id); | 399 return l10n_util::GetStringUTF16(resource_id); |
| 401 return string16(); | 400 return string16(); |
| 402 } | 401 } |
| 403 | 402 |
| 404 // static | 403 // static |
| 405 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 404 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 406 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 405 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 407 installer::SetTranslationDelegate(&delegate); | 406 installer::SetTranslationDelegate(&delegate); |
| 408 } | 407 } |
| OLD | NEW |