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" | |
34 #include "chrome/common/env_vars.h" | 33 #include "chrome/common/env_vars.h" |
35 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 34 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
36 #include "chrome/installer/util/browser_distribution.h" | 35 #include "chrome/installer/util/browser_distribution.h" |
37 #include "chrome/installer/util/helper.h" | 36 #include "chrome/installer/util/helper.h" |
38 #include "chrome/installer/util/install_util.h" | 37 #include "chrome/installer/util/install_util.h" |
39 #include "chrome/installer/util/l10n_string_util.h" | 38 #include "chrome/installer/util/l10n_string_util.h" |
40 #include "chrome/installer/util/shell_util.h" | 39 #include "chrome/installer/util/shell_util.h" |
41 #include "content/public/common/main_function_params.h" | 40 #include "content/public/common/main_function_params.h" |
42 #include "grit/app_locale_settings.h" | 41 #include "grit/app_locale_settings.h" |
43 #include "grit/chromium_strings.h" | 42 #include "grit/chromium_strings.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 << user_shortcut_locations[i]; | 134 << user_shortcut_locations[i]; |
136 } | 135 } |
137 } | 136 } |
138 } else { | 137 } else { |
139 NOTREACHED(); | 138 NOTREACHED(); |
140 } | 139 } |
141 } | 140 } |
142 return result; | 141 return result; |
143 } | 142 } |
144 | 143 |
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 | |
159 // ChromeBrowserMainPartsWin --------------------------------------------------- | 144 // ChromeBrowserMainPartsWin --------------------------------------------------- |
160 | 145 |
161 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( | 146 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
162 const content::MainFunctionParams& parameters) | 147 const content::MainFunctionParams& parameters) |
163 : ChromeBrowserMainParts(parameters) { | 148 : ChromeBrowserMainParts(parameters) { |
164 MaybeEnableHighResolutionTimeEverywhere(); | |
165 if (base::win::IsMetroProcess()) { | 149 if (base::win::IsMetroProcess()) { |
166 typedef const wchar_t* (*GetMetroSwitches)(void); | 150 typedef const wchar_t* (*GetMetroSwitches)(void); |
167 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( | 151 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( |
168 GetProcAddress(base::win::GetMetroModule(), | 152 GetProcAddress(base::win::GetMetroModule(), |
169 "GetMetroCommandLineSwitches")); | 153 "GetMetroCommandLineSwitches")); |
170 if (metro_switches_proc) { | 154 if (metro_switches_proc) { |
171 string16 metro_switches = (*metro_switches_proc)(); | 155 string16 metro_switches = (*metro_switches_proc)(); |
172 if (!metro_switches.empty()) { | 156 if (!metro_switches.empty()) { |
173 CommandLine extra_switches(CommandLine::NO_PROGRAM); | 157 CommandLine extra_switches(CommandLine::NO_PROGRAM); |
174 extra_switches.ParseFromString(metro_switches); | 158 extra_switches.ParseFromString(metro_switches); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (resource_id) | 377 if (resource_id) |
394 return l10n_util::GetStringUTF16(resource_id); | 378 return l10n_util::GetStringUTF16(resource_id); |
395 return string16(); | 379 return string16(); |
396 } | 380 } |
397 | 381 |
398 // static | 382 // static |
399 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 383 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
400 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 384 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
401 installer::SetTranslationDelegate(&delegate); | 385 installer::SetTranslationDelegate(&delegate); |
402 } | 386 } |
OLD | NEW |