Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Side by Side Diff: chrome/browser/ui/webui/version_handler.cc

Issue 2607953002: Add flash plugin path to chrome://version (Closed)
Patch Set: Fix build on windows. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698