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

Unified Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 2154773002: Implement Just-In-Time Flash updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git pull && gclient sync Created 4 years, 5 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/plugins/plugin_info_message_filter.h ('k') | chrome/browser/plugins/plugin_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_info_message_filter.cc
diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
index 6f6e18fd1c146abba9a960857812b3174e2e28e2..06a7755d7e3580dd7ae56b1399c6e2f8a033686e 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -24,6 +25,7 @@
#include "chrome/browser/ui/browser_otr_state.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
+#include "components/component_updater/component_updater_service.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/browser/plugins_field_trial.h"
@@ -251,32 +253,32 @@ void PluginInfoMessageFilter::PluginsLoaded(
const GetPluginInfo_Params& params,
IPC::Message* reply_msg,
const std::vector<WebPluginInfo>& plugins) {
- ChromeViewHostMsg_GetPluginInfo_Output output;
+ std::unique_ptr<ChromeViewHostMsg_GetPluginInfo_Output> output(
+ new ChromeViewHostMsg_GetPluginInfo_Output());
// This also fills in |actual_mime_type|.
std::unique_ptr<PluginMetadata> plugin_metadata;
if (context_.FindEnabledPlugin(params.render_frame_id, params.url,
params.top_origin_url, params.mime_type,
- &output.status, &output.plugin,
- &output.actual_mime_type,
- &plugin_metadata)) {
- context_.DecidePluginStatus(params, output.plugin, plugin_metadata.get(),
- &output.status);
+ &output->status, &output->plugin,
+ &output->actual_mime_type, &plugin_metadata)) {
+ context_.DecidePluginStatus(params, output->plugin, plugin_metadata.get(),
+ &output->status);
}
- if (plugin_metadata) {
- output.group_identifier = plugin_metadata->identifier();
- output.group_name = plugin_metadata->name();
- }
-
- context_.MaybeGrantAccess(output.status, output.plugin.path);
-
- ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output);
- Send(reply_msg);
- if (output.status !=
- ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) {
- main_thread_task_runner_->PostTask(
- FROM_HERE, base::Bind(&ReportMetrics, output.actual_mime_type,
- params.url, params.top_origin_url));
+ if (output->status == ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) {
+ // Check to see if the component updater can fetch an implementation.
+ base::PostTaskAndReplyWithResult(
+ main_thread_task_runner_.get(), FROM_HERE,
+ base::Bind(
+ &component_updater::ComponentUpdateService::GetComponentForMimeType,
+ base::Unretained(g_browser_process->component_updater()),
+ params.mime_type),
+ base::Bind(&PluginInfoMessageFilter::ComponentPluginLookupDone, this,
+ params, base::Passed(&output),
+ base::Passed(&plugin_metadata), reply_msg));
+ } else {
+ GetPluginInfoReply(params, std::move(output), std::move(plugin_metadata),
+ reply_msg);
}
}
@@ -316,7 +318,7 @@ void PluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
}
-#endif // defined(ENABLE_PEPPER_CDMS)
+#endif // defined(ENABLE_PEPPER_CDMS)
void PluginInfoMessageFilter::Context::DecidePluginStatus(
const GetPluginInfo_Params& params,
@@ -404,7 +406,6 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
if (extensions::WebViewRendererState::GetInstance()->IsGuest(
render_process_id_))
*status = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
-
}
#endif
}
@@ -460,6 +461,44 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
return enabled;
}
+void PluginInfoMessageFilter::ComponentPluginLookupDone(
+ const GetPluginInfo_Params& params,
+ std::unique_ptr<ChromeViewHostMsg_GetPluginInfo_Output> output,
+ std::unique_ptr<PluginMetadata> plugin_metadata,
+ IPC::Message* reply_msg,
+ std::unique_ptr<component_updater::ComponentInfo> cus_plugin_info) {
+ if (cus_plugin_info) {
+ output->status =
+ ChromeViewHostMsg_GetPluginInfo_Status::kComponentUpdateRequired;
+ plugin_metadata.reset(new PluginMetadata(
+ cus_plugin_info->id, cus_plugin_info->name, false, GURL(), GURL(),
+ base::ASCIIToUTF16(cus_plugin_info->id), std::string()));
+ }
+ GetPluginInfoReply(params, std::move(output), std::move(plugin_metadata),
+ reply_msg);
+}
+
+void PluginInfoMessageFilter::GetPluginInfoReply(
+ const GetPluginInfo_Params& params,
+ std::unique_ptr<ChromeViewHostMsg_GetPluginInfo_Output> output,
+ std::unique_ptr<PluginMetadata> plugin_metadata,
+ IPC::Message* reply_msg) {
+ if (plugin_metadata) {
+ output->group_identifier = plugin_metadata->identifier();
+ output->group_name = plugin_metadata->name();
+ }
+
+ context_.MaybeGrantAccess(output->status, output->plugin.path);
+
+ ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, *output);
+ Send(reply_msg);
+ if (output->status != ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) {
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&ReportMetrics, output->actual_mime_type,
+ params.url, params.top_origin_url));
+ }
+}
+
void PluginInfoMessageFilter::Context::GetPluginContentSetting(
const WebPluginInfo& plugin,
const GURL& policy_url,
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/browser/plugins/plugin_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698