| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 << user_shortcut_locations[i]; | 145 << user_shortcut_locations[i]; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 } else { | 148 } else { |
| 149 NOTREACHED(); | 149 NOTREACHED(); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 return result; | 152 return result; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void MaybeEnableHighResolutionTimeEverywhere() { | |
| 156 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
| 157 bool user_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | |
| 158 switches::kEnableHighResolutionTime); | |
| 159 if (user_enabled || channel == chrome::VersionInfo::CHANNEL_CANARY) { | |
| 160 bool is_enabled = base::TimeTicks::SetNowIsHighResNowIfSupported(); | |
| 161 if (is_enabled && !user_enabled) { | |
| 162 // Ensure that all of the renderers will enable it too. | |
| 163 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 164 switches::kEnableHighResolutionTime); | |
| 165 } | |
| 166 } | |
| 167 } | |
| 168 | |
| 169 // ChromeBrowserMainPartsWin --------------------------------------------------- | 155 // ChromeBrowserMainPartsWin --------------------------------------------------- |
| 170 | 156 |
| 171 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( | 157 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
| 172 const content::MainFunctionParams& parameters) | 158 const content::MainFunctionParams& parameters) |
| 173 : ChromeBrowserMainParts(parameters) { | 159 : ChromeBrowserMainParts(parameters) { |
| 174 MaybeEnableHighResolutionTimeEverywhere(); | 160 base::TimeTicks::SetNowIsHighResNowIfSupported(); |
| 175 if (base::win::IsMetroProcess()) { | 161 if (base::win::IsMetroProcess()) { |
| 176 typedef const wchar_t* (*GetMetroSwitches)(void); | 162 typedef const wchar_t* (*GetMetroSwitches)(void); |
| 177 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( | 163 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( |
| 178 GetProcAddress(base::win::GetMetroModule(), | 164 GetProcAddress(base::win::GetMetroModule(), |
| 179 "GetMetroCommandLineSwitches")); | 165 "GetMetroCommandLineSwitches")); |
| 180 if (metro_switches_proc) { | 166 if (metro_switches_proc) { |
| 181 base::string16 metro_switches = (*metro_switches_proc)(); | 167 base::string16 metro_switches = (*metro_switches_proc)(); |
| 182 if (!metro_switches.empty()) { | 168 if (!metro_switches.empty()) { |
| 183 CommandLine extra_switches(CommandLine::NO_PROGRAM); | 169 CommandLine extra_switches(CommandLine::NO_PROGRAM); |
| 184 extra_switches.ParseFromString(metro_switches); | 170 extra_switches.ParseFromString(metro_switches); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (resource_id) | 424 if (resource_id) |
| 439 return l10n_util::GetStringUTF16(resource_id); | 425 return l10n_util::GetStringUTF16(resource_id); |
| 440 return base::string16(); | 426 return base::string16(); |
| 441 } | 427 } |
| 442 | 428 |
| 443 // static | 429 // static |
| 444 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 430 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 445 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 431 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 446 installer::SetTranslationDelegate(&delegate); | 432 installer::SetTranslationDelegate(&delegate); |
| 447 } | 433 } |
| OLD | NEW |