| 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 12 matching lines...) Expand all Loading... |
| 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/profiles/profile_info_cache.h" | 25 #include "chrome/browser/profiles/profile_info_cache.h" |
| 26 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 26 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 27 #include "chrome/browser/shell_integration.h" | 27 #include "chrome/browser/shell_integration.h" |
| 28 #include "chrome/browser/ui/simple_message_box.h" | 28 #include "chrome/browser/ui/simple_message_box.h" |
| 29 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 29 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_result_codes.h" | 31 #include "chrome/common/chrome_result_codes.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/chrome_version_info.h" |
| 33 #include "chrome/common/env_vars.h" | 34 #include "chrome/common/env_vars.h" |
| 34 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 35 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 35 #include "chrome/installer/util/browser_distribution.h" | 36 #include "chrome/installer/util/browser_distribution.h" |
| 36 #include "chrome/installer/util/helper.h" | 37 #include "chrome/installer/util/helper.h" |
| 37 #include "chrome/installer/util/install_util.h" | 38 #include "chrome/installer/util/install_util.h" |
| 38 #include "chrome/installer/util/l10n_string_util.h" | 39 #include "chrome/installer/util/l10n_string_util.h" |
| 39 #include "chrome/installer/util/shell_util.h" | 40 #include "chrome/installer/util/shell_util.h" |
| 40 #include "content/public/common/main_function_params.h" | 41 #include "content/public/common/main_function_params.h" |
| 41 #include "grit/app_locale_settings.h" | 42 #include "grit/app_locale_settings.h" |
| 42 #include "grit/chromium_strings.h" | 43 #include "grit/chromium_strings.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 << user_shortcut_locations[i]; | 135 << user_shortcut_locations[i]; |
| 135 } | 136 } |
| 136 } | 137 } |
| 137 } else { | 138 } else { |
| 138 NOTREACHED(); | 139 NOTREACHED(); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 return result; | 142 return result; |
| 142 } | 143 } |
| 143 | 144 |
| 145 void MaybeEnableHighResolutionTimeEverywhere() { |
| 146 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 147 bool user_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
| 148 switches::kEnableHighResolutionTime); |
| 149 if (user_enabled || channel == chrome::VersionInfo::CHANNEL_CANARY) { |
| 150 bool is_enabled = base::TimeTicks::SetNowIsHighResNowIfSupported(); |
| 151 if (is_enabled && !user_enabled) { |
| 152 // Ensure that all of the renderers will enable it too. |
| 153 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 154 switches::kEnableHighResolutionTime); |
| 155 } |
| 156 } |
| 157 } |
| 158 |
| 144 // ChromeBrowserMainPartsWin --------------------------------------------------- | 159 // ChromeBrowserMainPartsWin --------------------------------------------------- |
| 145 | 160 |
| 146 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( | 161 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
| 147 const content::MainFunctionParams& parameters) | 162 const content::MainFunctionParams& parameters) |
| 148 : ChromeBrowserMainParts(parameters) { | 163 : ChromeBrowserMainParts(parameters) { |
| 164 MaybeEnableHighResolutionTimeEverywhere(); |
| 149 if (base::win::IsMetroProcess()) { | 165 if (base::win::IsMetroProcess()) { |
| 150 typedef const wchar_t* (*GetMetroSwitches)(void); | 166 typedef const wchar_t* (*GetMetroSwitches)(void); |
| 151 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( | 167 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( |
| 152 GetProcAddress(base::win::GetMetroModule(), | 168 GetProcAddress(base::win::GetMetroModule(), |
| 153 "GetMetroCommandLineSwitches")); | 169 "GetMetroCommandLineSwitches")); |
| 154 if (metro_switches_proc) { | 170 if (metro_switches_proc) { |
| 155 string16 metro_switches = (*metro_switches_proc)(); | 171 string16 metro_switches = (*metro_switches_proc)(); |
| 156 if (!metro_switches.empty()) { | 172 if (!metro_switches.empty()) { |
| 157 CommandLine extra_switches(CommandLine::NO_PROGRAM); | 173 CommandLine extra_switches(CommandLine::NO_PROGRAM); |
| 158 extra_switches.ParseFromString(metro_switches); | 174 extra_switches.ParseFromString(metro_switches); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if (resource_id) | 393 if (resource_id) |
| 378 return l10n_util::GetStringUTF16(resource_id); | 394 return l10n_util::GetStringUTF16(resource_id); |
| 379 return string16(); | 395 return string16(); |
| 380 } | 396 } |
| 381 | 397 |
| 382 // static | 398 // static |
| 383 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 399 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 384 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 400 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 385 installer::SetTranslationDelegate(&delegate); | 401 installer::SetTranslationDelegate(&delegate); |
| 386 } | 402 } |
| OLD | NEW |