| 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 "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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/plugins/plugin_prefs.h" | 11 #include "chrome/browser/plugins/plugin_prefs.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/metrics/variations/variations_util.h" | 13 #include "chrome/common/metrics/variations/variations_util.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/plugin_service.h" | 15 #include "content/public/browser/plugin_service.h" |
| 16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/common/content_constants.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 #include "webkit/plugins/plugin_constants.h" | |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Retrieves the executable and profile paths on the FILE thread. | 24 // Retrieves the executable and profile paths on the FILE thread. |
| 25 void GetFilePaths(const base::FilePath& profile_path, | 25 void GetFilePaths(const base::FilePath& profile_path, |
| 26 string16* exec_path_out, | 26 string16* exec_path_out, |
| 27 string16* profile_path_out) { | 27 string16* profile_path_out) { |
| 28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 29 | 29 |
| 30 base::FilePath executable_path = base::MakeAbsoluteFilePath( | 30 base::FilePath executable_path = base::MakeAbsoluteFilePath( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 StringValue profile_path(*profile_path_data); | 126 StringValue profile_path(*profile_path_data); |
| 127 web_ui()->CallJavascriptFunction("returnFilePaths", exec_path, profile_path); | 127 web_ui()->CallJavascriptFunction("returnFilePaths", exec_path, profile_path); |
| 128 } | 128 } |
| 129 | 129 |
| 130 #if defined(ENABLE_PLUGINS) | 130 #if defined(ENABLE_PLUGINS) |
| 131 void VersionHandler::OnGotPlugins( | 131 void VersionHandler::OnGotPlugins( |
| 132 const std::vector<content::WebPluginInfo>& plugins) { | 132 const std::vector<content::WebPluginInfo>& plugins) { |
| 133 // Obtain the version of the first enabled Flash plugin. | 133 // Obtain the version of the first enabled Flash plugin. |
| 134 std::vector<content::WebPluginInfo> info_array; | 134 std::vector<content::WebPluginInfo> info_array; |
| 135 content::PluginService::GetInstance()->GetPluginInfoArray( | 135 content::PluginService::GetInstance()->GetPluginInfoArray( |
| 136 GURL(), kFlashPluginSwfMimeType, false, &info_array, NULL); | 136 GURL(), content::kFlashPluginSwfMimeType, false, &info_array, NULL); |
| 137 string16 flash_version = | 137 string16 flash_version = |
| 138 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); | 138 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); |
| 139 PluginPrefs* plugin_prefs = | 139 PluginPrefs* plugin_prefs = |
| 140 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); | 140 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
| 141 if (plugin_prefs) { | 141 if (plugin_prefs) { |
| 142 for (size_t i = 0; i < info_array.size(); ++i) { | 142 for (size_t i = 0; i < info_array.size(); ++i) { |
| 143 if (plugin_prefs->IsPluginEnabled(info_array[i])) { | 143 if (plugin_prefs->IsPluginEnabled(info_array[i])) { |
| 144 flash_version = info_array[i].version; | 144 flash_version = info_array[i].version; |
| 145 break; | 145 break; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 StringValue arg(flash_version); | 150 StringValue arg(flash_version); |
| 151 web_ui()->CallJavascriptFunction("returnFlashVersion", arg); | 151 web_ui()->CallJavascriptFunction("returnFlashVersion", arg); |
| 152 } | 152 } |
| 153 #endif // defined(ENABLE_PLUGINS) | 153 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |