Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "base/win/metro.h" | 21 #include "base/win/metro.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/storage_monitor/storage_monitor_win.h" | 30 #include "chrome/browser/storage_monitor/storage_monitor_win.h" |
| 31 #include "chrome/browser/search_engines/template_url.h" | |
| 32 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | |
| 33 #include "chrome/browser/search_engines/template_url_service.h" | |
| 34 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
| 31 #include "chrome/browser/ui/simple_message_box.h" | 35 #include "chrome/browser/ui/simple_message_box.h" |
| 32 #include "chrome/browser/ui/uninstall_browser_prompt.h" | 36 #include "chrome/browser/ui/uninstall_browser_prompt.h" |
| 33 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
| 34 #include "chrome/common/chrome_result_codes.h" | 38 #include "chrome/common/chrome_result_codes.h" |
| 35 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/env_vars.h" | 40 #include "chrome/common/env_vars.h" |
| 37 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 41 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 38 #include "chrome/installer/util/browser_distribution.h" | 42 #include "chrome/installer/util/browser_distribution.h" |
| 39 #include "chrome/installer/util/helper.h" | 43 #include "chrome/installer/util/helper.h" |
| 40 #include "chrome/installer/util/install_util.h" | 44 #include "chrome/installer/util/install_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 return min_font_size; | 84 return min_font_size; |
| 81 } | 85 } |
| 82 | 86 |
| 83 class TranslationDelegate : public installer::TranslationDelegate { | 87 class TranslationDelegate : public installer::TranslationDelegate { |
| 84 public: | 88 public: |
| 85 virtual string16 GetLocalizedString(int installer_string_id) OVERRIDE; | 89 virtual string16 GetLocalizedString(int installer_string_id) OVERRIDE; |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 } // namespace | 92 } // namespace |
| 89 | 93 |
| 90 void RecordBreakpadStatusUMA(MetricsService* metrics) { | |
| 91 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); | |
| 92 } | |
| 93 | |
| 94 void WarnAboutMinimumSystemRequirements() { | |
| 95 if (base::win::GetVersion() < base::win::VERSION_XP) { | |
| 96 chrome::ShowMessageBox(NULL, | |
| 97 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | |
| 98 l10n_util::GetStringUTF16(IDS_UNSUPPORTED_OS_PRE_WIN_XP), | |
| 99 chrome::MESSAGE_BOX_TYPE_WARNING); | |
| 100 } | |
| 101 } | |
| 102 | |
| 103 void ShowCloseBrowserFirstMessageBox() { | 94 void ShowCloseBrowserFirstMessageBox() { |
| 104 int message_id = IDS_UNINSTALL_CLOSE_APP; | 95 int message_id = IDS_UNINSTALL_CLOSE_APP; |
| 105 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 96 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
| 106 (ShellIntegration::GetDefaultBrowser() == ShellIntegration::IS_DEFAULT)) { | 97 (ShellIntegration::GetDefaultBrowser() == ShellIntegration::IS_DEFAULT)) { |
| 107 message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE; | 98 message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE; |
| 108 } | 99 } |
| 109 chrome::ShowMessageBox(NULL, | 100 chrome::ShowMessageBox(NULL, |
| 110 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 101 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| 111 l10n_util::GetStringUTF16(message_id), | 102 l10n_util::GetStringUTF16(message_id), |
| 112 chrome::MESSAGE_BOX_TYPE_WARNING); | 103 chrome::MESSAGE_BOX_TYPE_WARNING); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 // setup.exe. In Chrome, these strings are in the locale files. | 183 // setup.exe. In Chrome, these strings are in the locale files. |
| 193 SetupInstallerUtilStrings(); | 184 SetupInstallerUtilStrings(); |
| 194 | 185 |
| 195 ChromeBrowserMainParts::PreMainMessageLoopStart(); | 186 ChromeBrowserMainParts::PreMainMessageLoopStart(); |
| 196 if (!parameters().ui_task) { | 187 if (!parameters().ui_task) { |
| 197 // Make sure that we know how to handle exceptions from the message loop. | 188 // Make sure that we know how to handle exceptions from the message loop. |
| 198 InitializeWindowProcExceptions(); | 189 InitializeWindowProcExceptions(); |
| 199 } | 190 } |
| 200 } | 191 } |
| 201 | 192 |
| 193 int ChromeBrowserMainPartsWin::PreCreateThreads() { | |
| 194 // TODO(viettrungluu): why don't we run this earlier? | |
|
Nico
2013/07/10 17:32:50
This now runs earlier, maybe this comment can go n
jam
2013/07/10 17:47:02
only slightly earlier. i think vtl's comment was w
| |
| 195 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs) && | |
| 196 base::win::GetVersion() < base::win::VERSION_XP) { | |
| 197 chrome::ShowMessageBox(NULL, | |
| 198 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | |
| 199 l10n_util::GetStringUTF16(IDS_UNSUPPORTED_OS_PRE_WIN_XP), | |
| 200 chrome::MESSAGE_BOX_TYPE_WARNING); | |
| 201 } | |
| 202 | |
| 203 return ChromeBrowserMainParts::PreCreateThreads(); | |
| 204 } | |
| 205 | |
| 206 void ChromeBrowserMainPartsWin::PostMainMessageLoopRun() { | |
| 207 // Log the search engine chosen on first run. Do this at shutdown, after any | |
| 208 // changes are made from the first run bubble link, etc. | |
| 209 if (do_first_run_tasks() && !profile()->IsOffTheRecord()) { | |
|
Nico
2013/07/10 17:32:50
(+gab to check that do_first_run_tasks_ isn't rese
jam
2013/07/10 17:47:02
right, it's not reset. (i had checked that)
gab
2013/07/10 17:48:58
Ya, it's never reset, let me know if you want me t
| |
| 210 TemplateURLService* url_service = | |
| 211 TemplateURLServiceFactory::GetForProfile(profile()); | |
| 212 const TemplateURL* default_search_engine = | |
| 213 url_service->GetDefaultSearchProvider(); | |
| 214 // The default engine can be NULL if the administrator has disabled | |
| 215 // default search. | |
| 216 SearchEngineType search_engine_type = | |
| 217 TemplateURLPrepopulateData::GetEngineType(default_search_engine ? | |
| 218 default_search_engine->url() : std::string()); | |
| 219 // Record the search engine chosen. | |
| 220 UMA_HISTOGRAM_ENUMERATION("Chrome.SearchSelectExempt", search_engine_type, | |
| 221 SEARCH_ENGINE_MAX); | |
| 222 } | |
| 223 | |
| 224 ChromeBrowserMainParts::PostMainMessageLoopRun(); | |
| 225 } | |
| 226 | |
| 202 void ChromeBrowserMainPartsWin::PreProfileInit() { | 227 void ChromeBrowserMainPartsWin::PreProfileInit() { |
| 203 storage_monitor_.reset(chrome::StorageMonitorWin::Create()); | 228 storage_monitor_.reset(chrome::StorageMonitorWin::Create()); |
| 204 | 229 |
| 205 ChromeBrowserMainParts::PreProfileInit(); | 230 ChromeBrowserMainParts::PreProfileInit(); |
| 206 } | 231 } |
| 207 | 232 |
| 208 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 233 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
| 209 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 234 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
| 210 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), | 235 ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
| 211 MB_OK | MB_ICONERROR | MB_TOPMOST); | 236 MB_OK | MB_ICONERROR | MB_TOPMOST); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 if (resource_id) | 405 if (resource_id) |
| 381 return l10n_util::GetStringUTF16(resource_id); | 406 return l10n_util::GetStringUTF16(resource_id); |
| 382 return string16(); | 407 return string16(); |
| 383 } | 408 } |
| 384 | 409 |
| 385 // static | 410 // static |
| 386 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 411 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 387 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 412 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 388 installer::SetTranslationDelegate(&delegate); | 413 installer::SetTranslationDelegate(&delegate); |
| 389 } | 414 } |
| OLD | NEW |