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

Unified Diff: chrome/browser/ui/webui/plugins_ui.cc

Issue 9536013: Move |requires_authorization| flag for plug-ins out of webkit/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/plugins_win.json ('k') | content/utility/utility_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/plugins_ui.cc
diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc
index a2f46aa21330441ec76716477278fd4fa5af70b3..c1340a0e7b6391064e82745344efc3951dac8ea2 100644
--- a/chrome/browser/ui/webui/plugins_ui.cc
+++ b/chrome/browser/ui/webui/plugins_ui.cc
@@ -44,6 +44,15 @@
#include "ui/base/resource/resource_bundle.h"
#include "webkit/plugins/npapi/plugin_group.h"
+#if defined(ENABLE_PLUGIN_INSTALLATION)
+#include "chrome/browser/plugin_finder.h"
+#include "chrome/browser/plugin_installer.h"
+#else
+// Forward-declare PluginFinder. It's never actually used, but we pass a NULL
+// pointer instead.
+class PluginFinder;
+#endif
+
using content::PluginService;
using content::WebContents;
using content::WebUIMessageHandler;
@@ -149,10 +158,14 @@ class PluginsDOMHandler : public WebUIMessageHandler,
private:
// Call this to start getting the plugins on the UI thread.
- void LoadPlugins();
+ void GetPluginFinder();
+
+ // Called when we have a PluginFinder and need to load the list of plug-ins.
+ void LoadPlugins(PluginFinder* plugin_finder);
// Called on the UI thread when the plugin information is ready.
- void PluginsLoaded(const std::vector<PluginGroup>& groups);
+ void PluginsLoaded(PluginFinder* plugin_finder,
+ const std::vector<PluginGroup>& groups);
content::NotificationRegistrar registrar_;
@@ -197,7 +210,7 @@ void PluginsDOMHandler::RegisterMessages() {
}
void PluginsDOMHandler::HandleRequestPluginsData(const ListValue* args) {
- LoadPlugins();
+ GetPluginFinder();
}
void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) {
@@ -295,22 +308,31 @@ void PluginsDOMHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type);
- LoadPlugins();
+ GetPluginFinder();
}
-void PluginsDOMHandler::LoadPlugins() {
+void PluginsDOMHandler::GetPluginFinder() {
if (weak_ptr_factory_.HasWeakPtrs())
return;
+#if defined(ENABLE_PLUGIN_INSTALLATION)
+ PluginFinder::Get(base::Bind(&PluginsDOMHandler::LoadPlugins,
+ weak_ptr_factory_.GetWeakPtr()));
+#else
+ LoadPlugins(NULL);
+#endif
+}
+
+void PluginsDOMHandler::LoadPlugins(PluginFinder* plugin_finder) {
PluginService::GetInstance()->GetPluginGroups(
base::Bind(&PluginsDOMHandler::PluginsLoaded,
- weak_ptr_factory_.GetWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr(), plugin_finder));
}
-void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
+void PluginsDOMHandler::PluginsLoaded(PluginFinder* plugin_finder,
+ const std::vector<PluginGroup>& groups) {
Profile* profile = Profile::FromWebUI(web_ui());
- PluginPrefs* plugin_prefs =
- PluginPrefs::GetForProfile(profile);
+ PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile);
HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard();
@@ -396,7 +418,15 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
group_data->SetString("description", active_plugin->desc);
group_data->SetString("version", active_plugin->version);
group_data->SetBoolean("critical", group.IsVulnerable(*active_plugin));
- group_data->SetString("update_url", group.GetUpdateURL());
+
+ std::string update_url;
+#if defined(ENABLE_PLUGIN_INSTALLATION)
+ PluginInstaller* installer =
+ plugin_finder->FindPluginWithIdentifier(group.identifier());
+ if (installer)
+ update_url = installer->plugin_url().spec();
+#endif
+ group_data->SetString("update_url", update_url);
std::string enabled_mode;
if (all_plugins_enabled_by_policy) {
@@ -410,7 +440,7 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) {
}
group_data->SetString("enabledMode", enabled_mode);
- // TODO(bauerb): We should have a method on HostContentSettinsMap for this.
+ // TODO(bauerb): We should have a method on HostContentSettingsMap for this.
bool always_allowed = false;
ContentSettingsForOneType settings;
map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS,
« no previous file with comments | « chrome/browser/resources/plugins_win.json ('k') | content/utility/utility_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698