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

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

Issue 10990078: Cleanup: Use plugin constants in more places. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/flash_ui.cc ('k') | chrome/renderer/plugins/plugin_placeholder.cc » ('j') | 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/plugins/plugin_prefs.h" 12 #include "chrome/browser/plugins/plugin_prefs.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/metrics/variations/variations_util.h" 14 #include "chrome/common/metrics/variations/variations_util.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/plugin_service.h" 16 #include "content/public/browser/plugin_service.h"
17 #include "content/public/browser/web_ui.h" 17 #include "content/public/browser/web_ui.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "webkit/plugins/plugin_constants.h"
21 22
22 namespace { 23 namespace {
23 24
24 // Retrieves the executable and profile paths on the FILE thread. 25 // Retrieves the executable and profile paths on the FILE thread.
25 void GetFilePaths(const FilePath& profile_path, 26 void GetFilePaths(const FilePath& profile_path,
26 string16* exec_path_out, 27 string16* exec_path_out,
27 string16* profile_path_out) { 28 string16* profile_path_out) {
28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 29 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
29 30
30 FilePath executable_path = CommandLine::ForCurrentProcess()->GetProgram(); 31 FilePath executable_path = CommandLine::ForCurrentProcess()->GetProgram();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 StringValue profile_path(*profile_path_data); 126 StringValue profile_path(*profile_path_data);
126 web_ui()->CallJavascriptFunction("returnFilePaths", exec_path, profile_path); 127 web_ui()->CallJavascriptFunction("returnFilePaths", exec_path, profile_path);
127 } 128 }
128 129
129 void VersionHandler::OnGotPlugins( 130 void VersionHandler::OnGotPlugins(
130 const std::vector<webkit::WebPluginInfo>& plugins) { 131 const std::vector<webkit::WebPluginInfo>& plugins) {
131 #if !defined(OS_ANDROID) 132 #if !defined(OS_ANDROID)
132 // Obtain the version of the first enabled Flash plugin. 133 // Obtain the version of the first enabled Flash plugin.
133 std::vector<webkit::WebPluginInfo> info_array; 134 std::vector<webkit::WebPluginInfo> info_array;
134 content::PluginService::GetInstance()->GetPluginInfoArray( 135 content::PluginService::GetInstance()->GetPluginInfoArray(
135 GURL(), "application/x-shockwave-flash", false, &info_array, NULL); 136 GURL(), kFlashPluginSwfMimeType, false, &info_array, NULL);
136 string16 flash_version = 137 string16 flash_version =
137 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); 138 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN);
138 PluginPrefs* plugin_prefs = 139 PluginPrefs* plugin_prefs =
139 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())); 140 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui()));
140 if (plugin_prefs) { 141 if (plugin_prefs) {
141 for (size_t i = 0; i < info_array.size(); ++i) { 142 for (size_t i = 0; i < info_array.size(); ++i) {
142 if (plugin_prefs->IsPluginEnabled(info_array[i])) { 143 if (plugin_prefs->IsPluginEnabled(info_array[i])) {
143 flash_version = info_array[i].version; 144 flash_version = info_array[i].version;
144 break; 145 break;
145 } 146 }
146 } 147 }
147 } 148 }
148 149
149 StringValue arg(flash_version); 150 StringValue arg(flash_version);
150 web_ui()->CallJavascriptFunction("returnFlashVersion", arg); 151 web_ui()->CallJavascriptFunction("returnFlashVersion", arg);
151 #endif 152 #endif
152 } 153 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/flash_ui.cc ('k') | chrome/renderer/plugins/plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698