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/text_services_message_filter.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/first_run/first_run.h" | 25 #include "chrome/browser/first_run/first_run.h" |
26 #include "chrome/browser/metrics/metrics_service.h" | 26 #include "chrome/browser/metrics/metrics_service.h" |
27 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
28 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 28 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
29 #include "chrome/browser/shell_integration.h" | 29 #include "chrome/browser/shell_integration.h" |
| 30 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_
win.h" |
30 #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" |
31 #include "chrome/browser/ui/simple_message_box.h" | 32 #include "chrome/browser/ui/simple_message_box.h" |
32 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 33 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
33 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
34 #include "chrome/common/chrome_result_codes.h" | 35 #include "chrome/common/chrome_result_codes.h" |
35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/env_vars.h" | 37 #include "chrome/common/env_vars.h" |
37 #include "chrome/installer/util/browser_distribution.h" | 38 #include "chrome/installer/util/browser_distribution.h" |
38 #include "chrome/installer/util/helper.h" | 39 #include "chrome/installer/util/helper.h" |
39 #include "chrome/installer/util/install_util.h" | 40 #include "chrome/installer/util/install_util.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { | 194 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { |
194 // installer_util references strings that are normally compiled into | 195 // installer_util references strings that are normally compiled into |
195 // setup.exe. In Chrome, these strings are in the locale files. | 196 // setup.exe. In Chrome, these strings are in the locale files. |
196 SetupInstallerUtilStrings(); | 197 SetupInstallerUtilStrings(); |
197 | 198 |
198 ChromeBrowserMainParts::PreMainMessageLoopStart(); | 199 ChromeBrowserMainParts::PreMainMessageLoopStart(); |
199 if (!parameters().ui_task) { | 200 if (!parameters().ui_task) { |
200 // Make sure that we know how to handle exceptions from the message loop. | 201 // Make sure that we know how to handle exceptions from the message loop. |
201 InitializeWindowProcExceptions(); | 202 InitializeWindowProcExceptions(); |
202 } | 203 } |
| 204 media_transfer_protocol_device_observer_ = |
| 205 new chrome::mtp::MediaTransferProtocolDeviceObserverWin(); |
203 removable_device_notifications_window_ = | 206 removable_device_notifications_window_ = |
204 new chrome::RemovableDeviceNotificationsWindowWin(); | 207 new chrome::RemovableDeviceNotificationsWindowWin(); |
205 } | 208 } |
206 | 209 |
207 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { | 210 void ChromeBrowserMainPartsWin::PostMainMessageLoopStart() { |
208 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 211 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
209 | 212 |
210 if (base::win::IsTsfAwareRequired()) { | 213 if (base::win::IsTsfAwareRequired()) { |
211 // Create a TSF message filter for the message loop. MessageLoop takes | 214 // Create a TSF message filter for the message loop. MessageLoop takes |
212 // ownership of the filter. | 215 // ownership of the filter. |
213 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 216 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
214 new base::win::TextServicesMessageFilter); | 217 new base::win::TextServicesMessageFilter); |
215 if (tsf_message_filter->Init()) { | 218 if (tsf_message_filter->Init()) { |
216 MessageLoopForUI::current()->SetMessageFilter( | 219 MessageLoopForUI::current()->SetMessageFilter( |
217 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); | 220 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); |
218 } | 221 } |
219 } | 222 } |
220 } | 223 } |
221 | 224 |
222 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { | 225 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |
223 ChromeBrowserMainParts::PreMainMessageLoopRun(); | 226 ChromeBrowserMainParts::PreMainMessageLoopRun(); |
224 | 227 |
225 removable_device_notifications_window_->Init(); | 228 removable_device_notifications_window_->Init(); |
| 229 media_transfer_protocol_device_observer_->Init(); |
226 #if defined(USE_AURA) | 230 #if defined(USE_AURA) |
227 metro_viewer_process_host_.reset(new MetroViewerProcessHost); | 231 metro_viewer_process_host_.reset(new MetroViewerProcessHost); |
228 #endif | 232 #endif |
229 } | 233 } |
230 | 234 |
231 // static | 235 // static |
232 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 236 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
233 const CommandLine& parsed_command_line) { | 237 const CommandLine& parsed_command_line) { |
234 // Clear this var so child processes don't show the dialog by default. | 238 // Clear this var so child processes don't show the dialog by default. |
235 scoped_ptr<base::Environment> env(base::Environment::Create()); | 239 scoped_ptr<base::Environment> env(base::Environment::Create()); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 if (resource_id) | 384 if (resource_id) |
381 return l10n_util::GetStringUTF16(resource_id); | 385 return l10n_util::GetStringUTF16(resource_id); |
382 return string16(); | 386 return string16(); |
383 } | 387 } |
384 | 388 |
385 // static | 389 // static |
386 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 390 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
387 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 391 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
388 installer::SetTranslationDelegate(&delegate); | 392 installer::SetTranslationDelegate(&delegate); |
389 } | 393 } |
OLD | NEW |