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" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 html_source->AddString(version_ui::kCompiler, "MSVC 2017"); | 151 html_source->AddString(version_ui::kCompiler, "MSVC 2017"); |
152 #endif | 152 #endif |
153 #elif defined(_MSC_VER) | 153 #elif defined(_MSC_VER) |
154 #error "Unsupported version of MSVC." | 154 #error "Unsupported version of MSVC." |
155 #else | 155 #else |
156 html_source->AddString(version_ui::kCompiler, "Unknown"); | 156 html_source->AddString(version_ui::kCompiler, "Unknown"); |
157 #endif | 157 #endif |
158 | 158 |
159 base::string16 update_cohort_name = | 159 base::string16 update_cohort_name = |
160 install_static::InstallDetails::Get().update_cohort_name(); | 160 install_static::InstallDetails::Get().update_cohort_name(); |
161 if (!update_cohort_name.empty()) { | 161 if (!update_cohort_name.empty()) { |
Lei Zhang
2017/06/17 06:23:15
How about:
base::string16 display_cohort_name;
if
| |
162 html_source->AddString(version_ui::kUpdateCohortName, | 162 html_source->AddString(version_ui::kUpdateCohortName, |
163 l10n_util::GetStringFUTF16( | 163 l10n_util::GetStringFUTF16( |
164 IDS_VERSION_UI_COHORT_NAME, update_cohort_name)); | 164 IDS_VERSION_UI_COHORT_NAME, update_cohort_name)); |
165 } else { | |
166 html_source->AddString(version_ui::kUpdateCohortName, std::string()); | |
Lei Zhang
2017/06/17 06:23:15
Is this because $i18n{update_cohort_name} cannot t
dschuyler
2017/06/19 19:24:53
It is by design that $i18n won't allow the mistake
| |
165 } | 167 } |
166 #endif // defined(OS_WIN) | 168 #endif // defined(OS_WIN) |
167 | 169 |
168 html_source->SetJsonPath("strings.js"); | 170 html_source->SetJsonPath("strings.js"); |
169 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); | 171 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); |
170 html_source->AddResourcePath(version_ui::kAboutVersionCSS, | 172 html_source->AddResourcePath(version_ui::kAboutVersionCSS, |
171 IDR_VERSION_UI_CSS); | 173 IDR_VERSION_UI_CSS); |
172 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); | 174 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); |
173 return html_source; | 175 return html_source; |
174 } | 176 } |
(...skipping 14 matching lines...) Expand all Loading... | |
189 // Set up the chrome://theme/ source. | 191 // Set up the chrome://theme/ source. |
190 ThemeSource* theme = new ThemeSource(profile); | 192 ThemeSource* theme = new ThemeSource(profile); |
191 content::URLDataSource::Add(profile, theme); | 193 content::URLDataSource::Add(profile, theme); |
192 #endif | 194 #endif |
193 | 195 |
194 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); | 196 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); |
195 } | 197 } |
196 | 198 |
197 VersionUI::~VersionUI() { | 199 VersionUI::~VersionUI() { |
198 } | 200 } |
OLD | NEW |