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 |
159 #endif // defined(OS_WIN) | 160 #endif // defined(OS_WIN) |
scottmg
2017/04/03 18:02:54
Can just merge the new #if with this one.
grt (UTC plus 2)
2017/04/03 19:54:33
Done.
| |
160 | 161 |
162 #if defined(OS_WIN) | |
163 base::string16 update_cohort_name = | |
164 install_static::InstallDetails::Get().update_cohort_name(); | |
165 if (!update_cohort_name.empty()) { | |
166 html_source->AddString(version_ui::kUpdateCohortName, | |
167 l10n_util::GetStringFUTF16( | |
168 IDS_VERSION_UI_COHORT_NAME, update_cohort_name)); | |
169 } | |
170 #endif // defined(OS_WIN) | |
171 | |
161 html_source->SetJsonPath("strings.js"); | 172 html_source->SetJsonPath("strings.js"); |
162 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); | 173 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); |
163 html_source->AddResourcePath(version_ui::kAboutVersionCSS, | 174 html_source->AddResourcePath(version_ui::kAboutVersionCSS, |
164 IDR_VERSION_UI_CSS); | 175 IDR_VERSION_UI_CSS); |
165 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); | 176 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); |
166 return html_source; | 177 return html_source; |
167 } | 178 } |
168 | 179 |
169 } // namespace | 180 } // namespace |
170 | 181 |
(...skipping 11 matching lines...) Expand all Loading... | |
182 // Set up the chrome://theme/ source. | 193 // Set up the chrome://theme/ source. |
183 ThemeSource* theme = new ThemeSource(profile); | 194 ThemeSource* theme = new ThemeSource(profile); |
184 content::URLDataSource::Add(profile, theme); | 195 content::URLDataSource::Add(profile, theme); |
185 #endif | 196 #endif |
186 | 197 |
187 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); | 198 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); |
188 } | 199 } |
189 | 200 |
190 VersionUI::~VersionUI() { | 201 VersionUI::~VersionUI() { |
191 } | 202 } |
OLD | NEW |