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/ui/webui/version_handler.h" | 5 #include "chrome/browser/ui/webui/version_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 exec_path, profile_path); | 102 exec_path, profile_path); |
| 103 } | 103 } |
| 104 | 104 |
| 105 #if BUILDFLAG(ENABLE_PLUGINS) | 105 #if BUILDFLAG(ENABLE_PLUGINS) |
| 106 void VersionHandler::OnGotPlugins( | 106 void VersionHandler::OnGotPlugins( |
| 107 const std::vector<content::WebPluginInfo>& plugins) { | 107 const std::vector<content::WebPluginInfo>& plugins) { |
| 108 // Obtain the version of the first enabled Flash plugin. | 108 // Obtain the version of the first enabled Flash plugin. |
| 109 std::vector<content::WebPluginInfo> info_array; | 109 std::vector<content::WebPluginInfo> info_array; |
| 110 content::PluginService::GetInstance()->GetPluginInfoArray( | 110 content::PluginService::GetInstance()->GetPluginInfoArray( |
| 111 GURL(), content::kFlashPluginSwfMimeType, false, &info_array, NULL); | 111 GURL(), content::kFlashPluginSwfMimeType, false, &info_array, NULL); |
| 112 base::string16 flash_version = | 112 base::string16 flash_version_and_path = |
| 113 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); | 113 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); |
|
Bernhard Bauer
2017/01/03 15:23:17
So, it looks like chrome://version is localized? I
Greg K
2017/01/03 21:20:29
Acknowledged.
| |
| 114 PluginPrefs* plugin_prefs = | 114 PluginPrefs* plugin_prefs = |
| 115 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); | 115 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
| 116 if (plugin_prefs) { | 116 if (plugin_prefs) { |
| 117 for (size_t i = 0; i < info_array.size(); ++i) { | 117 for (size_t i = 0; i < info_array.size(); ++i) { |
| 118 if (plugin_prefs->IsPluginEnabled(info_array[i])) { | 118 if (plugin_prefs->IsPluginEnabled(info_array[i])) { |
| 119 flash_version = info_array[i].version; | 119 flash_version_and_path = info_array[i].version; |
| 120 flash_version_and_path.append(base::UTF8ToUTF16(" ")); | |
|
Bernhard Bauer
2017/01/03 15:23:17
I would use base::ASCIIToUTF16() for the literal.
Greg K
2017/01/03 21:20:29
I switched this to base::StringPrintf and tested w
| |
| 121 #if defined(OS_WIN) | |
| 122 flash_version_and_path.append(info_array[i].path.value()); | |
| 123 #else | |
| 124 flash_version_and_path.append( | |
| 125 base::UTF8ToUTF16(info_array[i].path.value())); | |
|
Bernhard Bauer
2017/01/03 15:23:17
Use FilePath::LossyDisplayName() instead of platfo
Greg K
2017/01/03 21:20:29
Done.
| |
| 126 #endif // defined(OS_WIN) | |
| 120 break; | 127 break; |
| 121 } | 128 } |
| 122 } | 129 } |
| 123 } | 130 } |
| 124 | 131 |
| 125 base::StringValue arg(flash_version); | 132 base::StringValue arg(flash_version_and_path); |
| 133 | |
| 126 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFlashVersion, arg); | 134 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFlashVersion, arg); |
| 127 } | 135 } |
| 128 #endif // BUILDFLAG(ENABLE_PLUGINS) | 136 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| OLD | NEW |