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_window_.reset( |
203 chrome::RemovableDeviceNotificationsWindowWin::Create()); | 203 chrome::StorageMonitorWin::Create()); |
204 } | 204 } |
205 | 205 |
206 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { | 206 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { |
207 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 207 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
208 | 208 |
209 if (base::win::IsTSFAwareRequired()) { | 209 if (base::win::IsTSFAwareRequired()) { |
210 // Create a TSF message filter for the message loop. MessageLoop takes | 210 // Create a TSF message filter for the message loop. MessageLoop takes |
211 // ownership of the filter. | 211 // ownership of the filter. |
212 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 212 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
213 new base::win::TextServicesMessageFilter); | 213 new base::win::TextServicesMessageFilter); |
214 if (tsf_message_filter->Init()) { | 214 if (tsf_message_filter->Init()) { |
215 MessageLoopForUI::current()->SetMessageFilter( | 215 MessageLoopForUI::current()->SetMessageFilter( |
216 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); | 216 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { | 221 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |
222 ChromeBrowserMainParts::PreMainMessageLoopRun(); | 222 ChromeBrowserMainParts::PreMainMessageLoopRun(); |
223 | 223 |
224 removable_device_notifications_window_->Init(); | 224 storage_monitor_window_->Init(); |
225 } | 225 } |
226 | 226 |
227 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 227 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
228 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 228 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
229 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 229 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
230 MB_OK | MB_ICONERROR | MB_TOPMOST); | 230 MB_OK | MB_ICONERROR | MB_TOPMOST); |
231 } | 231 } |
232 | 232 |
233 // static | 233 // static |
234 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 234 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (resource_id) | 399 if (resource_id) |
400 return l10n_util::GetStringUTF16(resource_id); | 400 return l10n_util::GetStringUTF16(resource_id); |
401 return string16(); | 401 return string16(); |
402 } | 402 } |
403 | 403 |
404 // static | 404 // static |
405 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 405 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
406 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 406 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
407 installer::SetTranslationDelegate(&delegate); | 407 installer::SetTranslationDelegate(&delegate); |
408 } | 408 } |
OLD | NEW |