| 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/nacl_ui.h" | 5 #include "chrome/browser/ui/webui/nacl_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/json/json_file_value_serializer.h" | 14 #include "base/json/json_file_value_serializer.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/plugins/plugin_prefs.h" | 22 #include "chrome/browser/plugins/plugin_prefs.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/common/channel_info.h" |
| 24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/chrome_version_info.h" | |
| 27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "chrome/grit/chromium_strings.h" | 28 #include "chrome/grit/chromium_strings.h" |
| 29 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 30 #include "components/version_info/version_info.h" |
| 30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/plugin_service.h" | 32 #include "content/public/browser/plugin_service.h" |
| 32 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
| 33 #include "content/public/browser/web_ui.h" | 34 #include "content/public/browser/web_ui.h" |
| 34 #include "content/public/browser/web_ui_data_source.h" | 35 #include "content/public/browser/web_ui_data_source.h" |
| 35 #include "content/public/browser/web_ui_message_handler.h" | 36 #include "content/public/browser/web_ui_message_handler.h" |
| 36 #include "content/public/common/webplugininfo.h" | 37 #include "content/public/common/webplugininfo.h" |
| 37 #include "grit/browser_resources.h" | 38 #include "grit/browser_resources.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 39 | 40 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 PluginService::GetInstance()->GetPluginInfoArray( | 172 PluginService::GetInstance()->GetPluginInfoArray( |
| 172 GURL(), "application/x-nacl", false, &info_array, NULL); | 173 GURL(), "application/x-nacl", false, &info_array, NULL); |
| 173 PluginPrefs* plugin_prefs = | 174 PluginPrefs* plugin_prefs = |
| 174 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); | 175 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
| 175 return (!info_array.empty() && | 176 return (!info_array.empty() && |
| 176 plugin_prefs->IsPluginEnabled(info_array[plugin_index])); | 177 plugin_prefs->IsPluginEnabled(info_array[plugin_index])); |
| 177 } | 178 } |
| 178 | 179 |
| 179 void NaClDomHandler::AddOperatingSystemInfo(base::ListValue* list) { | 180 void NaClDomHandler::AddOperatingSystemInfo(base::ListValue* list) { |
| 180 // Obtain the Chrome version info. | 181 // Obtain the Chrome version info. |
| 181 chrome::VersionInfo version_info; | |
| 182 AddPair(list, | 182 AddPair(list, |
| 183 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 183 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| 184 ASCIIToUTF16(version_info.Version() + " (" + | 184 ASCIIToUTF16(version_info::GetVersionNumber() + " (" + |
| 185 chrome::VersionInfo::GetVersionStringModifier() + ")")); | 185 chrome::GetChannelString() + ")")); |
| 186 | 186 |
| 187 // OS version information. | 187 // OS version information. |
| 188 // TODO(jvoung): refactor this to share the extra windows labeling | 188 // TODO(jvoung): refactor this to share the extra windows labeling |
| 189 // with about:flash, or something. | 189 // with about:flash, or something. |
| 190 std::string os_label = version_info.OSType(); | 190 std::string os_label = version_info::GetOSType(); |
| 191 #if defined(OS_WIN) | 191 #if defined(OS_WIN) |
| 192 base::win::OSInfo* os = base::win::OSInfo::GetInstance(); | 192 base::win::OSInfo* os = base::win::OSInfo::GetInstance(); |
| 193 switch (os->version()) { | 193 switch (os->version()) { |
| 194 case base::win::VERSION_XP: os_label += " XP"; break; | 194 case base::win::VERSION_XP: os_label += " XP"; break; |
| 195 case base::win::VERSION_SERVER_2003: | 195 case base::win::VERSION_SERVER_2003: |
| 196 os_label += " Server 2003 or XP Pro 64 bit"; | 196 os_label += " Server 2003 or XP Pro 64 bit"; |
| 197 break; | 197 break; |
| 198 case base::win::VERSION_VISTA: os_label += " Vista or Server 2008"; break; | 198 case base::win::VERSION_VISTA: os_label += " Vista or Server 2008"; break; |
| 199 case base::win::VERSION_WIN7: os_label += " 7 or Server 2008 R2"; break; | 199 case base::win::VERSION_WIN7: os_label += " 7 or Server 2008 R2"; break; |
| 200 case base::win::VERSION_WIN8: os_label += " 8 or Server 2012"; break; | 200 case base::win::VERSION_WIN8: os_label += " 8 or Server 2012"; break; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 384 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 385 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 385 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
| 386 | 386 |
| 387 web_ui->AddMessageHandler(new NaClDomHandler()); | 387 web_ui->AddMessageHandler(new NaClDomHandler()); |
| 388 | 388 |
| 389 // Set up the about:nacl source. | 389 // Set up the about:nacl source. |
| 390 Profile* profile = Profile::FromWebUI(web_ui); | 390 Profile* profile = Profile::FromWebUI(web_ui); |
| 391 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 391 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
| 392 } | 392 } |
| OLD | NEW |