| 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/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 22 #include "base/win/wrapped_window_proc.h" | 22 #include "base/win/wrapped_window_proc.h" |
| 23 #include "chrome/browser/browser_util_win.h" | 23 #include "chrome/browser/browser_util_win.h" |
| 24 #include "chrome/browser/first_run/first_run.h" | 24 #include "chrome/browser/first_run/first_run.h" |
| 25 #include "chrome/browser/media_gallery/media_device_notification_window_win.h" |
| 25 #include "chrome/browser/metrics/metrics_service.h" | 26 #include "chrome/browser/metrics/metrics_service.h" |
| 26 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
| 27 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" | 28 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
| 28 #include "chrome/browser/simple_message_box.h" | 29 #include "chrome/browser/simple_message_box.h" |
| 29 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
| 30 #include "chrome/browser/ui/views/uninstall_view.h" | 31 #include "chrome/browser/ui/views/uninstall_view.h" |
| 31 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
| 32 #include "chrome/common/chrome_result_codes.h" | 33 #include "chrome/common/chrome_result_codes.h" |
| 33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/env_vars.h" | 35 #include "chrome/common/env_vars.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( | 163 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
| 163 const content::MainFunctionParams& parameters) | 164 const content::MainFunctionParams& parameters) |
| 164 : ChromeBrowserMainParts(parameters) { | 165 : ChromeBrowserMainParts(parameters) { |
| 165 if (base::win::GetMetroModule()) { | 166 if (base::win::GetMetroModule()) { |
| 166 CommandLine::ForCurrentProcess()->AppendSwitch( | 167 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 167 switches::kEnableTouchEvents); | 168 switches::kEnableTouchEvents); |
| 168 } | 169 } |
| 169 } | 170 } |
| 170 | 171 |
| 172 ChromeBrowserMainPartsWin::~ChromeBrowserMainPartsWin() { |
| 173 } |
| 174 |
| 171 void ChromeBrowserMainPartsWin::ToolkitInitialized() { | 175 void ChromeBrowserMainPartsWin::ToolkitInitialized() { |
| 172 ChromeBrowserMainParts::ToolkitInitialized(); | 176 ChromeBrowserMainParts::ToolkitInitialized(); |
| 173 gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; | 177 gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; |
| 174 gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; | 178 gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; |
| 175 } | 179 } |
| 176 | 180 |
| 177 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { | 181 void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { |
| 178 ChromeBrowserMainParts::PreMainMessageLoopStart(); | 182 ChromeBrowserMainParts::PreMainMessageLoopStart(); |
| 179 if (!parameters().ui_task) { | 183 if (!parameters().ui_task) { |
| 180 // Make sure that we know how to handle exceptions from the message loop. | 184 // Make sure that we know how to handle exceptions from the message loop. |
| 181 InitializeWindowProcExceptions(); | 185 InitializeWindowProcExceptions(); |
| 182 } | 186 } |
| 187 media_device_notification_window_.reset( |
| 188 new chrome::MediaDeviceNotificationWindowWin()); |
| 183 } | 189 } |
| 184 | 190 |
| 185 // static | 191 // static |
| 186 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 192 void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
| 187 const CommandLine& parsed_command_line) { | 193 const CommandLine& parsed_command_line) { |
| 188 // Clear this var so child processes don't show the dialog by default. | 194 // Clear this var so child processes don't show the dialog by default. |
| 189 scoped_ptr<base::Environment> env(base::Environment::Create()); | 195 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 190 env->UnSetVar(env_vars::kShowRestart); | 196 env->UnSetVar(env_vars::kShowRestart); |
| 191 | 197 |
| 192 // For non-interactive tests we don't restart on crash. | 198 // For non-interactive tests we don't restart on crash. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 314 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
| 309 uninstall_cmd.AppendSwitch( | 315 uninstall_cmd.AppendSwitch( |
| 310 installer::switches::kDoNotRemoveSharedItems); | 316 installer::switches::kDoNotRemoveSharedItems); |
| 311 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 317 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); |
| 312 } | 318 } |
| 313 return true; | 319 return true; |
| 314 } | 320 } |
| 315 } | 321 } |
| 316 return false; | 322 return false; |
| 317 } | 323 } |
| OLD | NEW |