| 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/ui/webui/version_ui.h" | 5 #include "chrome/browser/ui/webui/version_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/message_formatter.h" | 8 #include "base/i18n/message_formatter.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/version_handler.h" | 13 #include "chrome/browser/ui/webui/version_handler.h" |
| 14 #include "chrome/common/channel_info.h" | 14 #include "chrome/common/channel_info.h" |
| 15 #include "chrome/common/chrome_content_client.h" | 15 #include "chrome/common/chrome_content_client.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/grit/browser_resources.h" | 17 #include "chrome/grit/browser_resources.h" |
| 18 #include "chrome/grit/chromium_strings.h" | 18 #include "chrome/grit/chromium_strings.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "chrome/install_static/install_details.h" |
| 20 #include "components/grit/components_resources.h" | 21 #include "components/grit/components_resources.h" |
| 21 #include "components/strings/grit/components_chromium_strings.h" | 22 #include "components/strings/grit/components_chromium_strings.h" |
| 22 #include "components/strings/grit/components_strings.h" | 23 #include "components/strings/grit/components_strings.h" |
| 23 #include "components/version_info/version_info.h" | 24 #include "components/version_info/version_info.h" |
| 24 #include "components/version_ui/version_ui_constants.h" | 25 #include "components/version_ui/version_ui_constants.h" |
| 25 #include "content/public/browser/url_data_source.h" | 26 #include "content/public/browser/url_data_source.h" |
| 26 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
| 27 #include "content/public/browser/web_ui_data_source.h" | 28 #include "content/public/browser/web_ui_data_source.h" |
| 28 #include "content/public/common/user_agent.h" | 29 #include "content/public/common/user_agent.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 #if BUILDFLAG(PGO_BUILD) | 150 #if BUILDFLAG(PGO_BUILD) |
| 150 html_source->AddString(version_ui::kCompiler, "MSVC 2017 (PGO)"); | 151 html_source->AddString(version_ui::kCompiler, "MSVC 2017 (PGO)"); |
| 151 #else | 152 #else |
| 152 html_source->AddString(version_ui::kCompiler, "MSVC 2017"); | 153 html_source->AddString(version_ui::kCompiler, "MSVC 2017"); |
| 153 #endif | 154 #endif |
| 154 #elif defined(_MSC_VER) | 155 #elif defined(_MSC_VER) |
| 155 #error "Unsupported version of MSVC." | 156 #error "Unsupported version of MSVC." |
| 156 #else | 157 #else |
| 157 html_source->AddString(version_ui::kCompiler, "Unknown"); | 158 html_source->AddString(version_ui::kCompiler, "Unknown"); |
| 158 #endif | 159 #endif |
| 160 |
| 161 base::string16 update_cohort_name = |
| 162 install_static::InstallDetails::Get().update_cohort_name(); |
| 163 if (!update_cohort_name.empty()) { |
| 164 html_source->AddString(version_ui::kUpdateCohortName, |
| 165 l10n_util::GetStringFUTF16( |
| 166 IDS_VERSION_UI_COHORT_NAME, update_cohort_name)); |
| 167 } |
| 159 #endif // defined(OS_WIN) | 168 #endif // defined(OS_WIN) |
| 160 | 169 |
| 161 html_source->SetJsonPath("strings.js"); | 170 html_source->SetJsonPath("strings.js"); |
| 162 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); | 171 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); |
| 163 html_source->AddResourcePath(version_ui::kAboutVersionCSS, | 172 html_source->AddResourcePath(version_ui::kAboutVersionCSS, |
| 164 IDR_VERSION_UI_CSS); | 173 IDR_VERSION_UI_CSS); |
| 165 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); | 174 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); |
| 166 return html_source; | 175 return html_source; |
| 167 } | 176 } |
| 168 | 177 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 182 // Set up the chrome://theme/ source. | 191 // Set up the chrome://theme/ source. |
| 183 ThemeSource* theme = new ThemeSource(profile); | 192 ThemeSource* theme = new ThemeSource(profile); |
| 184 content::URLDataSource::Add(profile, theme); | 193 content::URLDataSource::Add(profile, theme); |
| 185 #endif | 194 #endif |
| 186 | 195 |
| 187 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); | 196 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); |
| 188 } | 197 } |
| 189 | 198 |
| 190 VersionUI::~VersionUI() { | 199 VersionUI::~VersionUI() { |
| 191 } | 200 } |
| OLD | NEW |