Commit 72b177c5 authored by raymes's avatar raymes Committed by Commit bot

Automatically refresh the page when the flash permission prompt is allowed

Rather than showing the infobar, just refresh the page. The user would usually
arrive in this situation because they've clicked a link to obtain flash, so
refreshing the page shouldn't be problematic.

BUG=641615,652479

Review-Url: https://codereview.chromium.org/2390193002
Cr-Commit-Position: refs/heads/master@{#422945}
parent 7969d3a5
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include "chrome/browser/plugins/flash_permission_context.h" #include "chrome/browser/plugins/flash_permission_context.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/permissions/permission_request_id.h" #include "chrome/browser/permissions/permission_request_id.h"
#include "chrome/browser/plugins/plugin_utils.h" #include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/plugins/plugins_field_trial.h" #include "chrome/browser/plugins/plugins_field_trial.h"
#include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
FlashPermissionContext::FlashPermissionContext(Profile* profile) FlashPermissionContext::FlashPermissionContext(Profile* profile)
: PermissionContextBase(profile, : PermissionContextBase(profile,
...@@ -38,14 +38,12 @@ void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, ...@@ -38,14 +38,12 @@ void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id,
bool allowed) { bool allowed) {
if (!allowed) if (!allowed)
return; return;
// Automatically refresh the page.
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost( content::WebContents::FromRenderFrameHost(
content::RenderFrameHost::FromID(id.render_process_id(), content::RenderFrameHost::FromID(id.render_process_id(),
id.render_frame_id())); id.render_frame_id()));
InfoBarService* infobar_service = web_contents->GetController().Reload(true /* check_for_repost */);
InfoBarService::FromWebContents(web_contents);
if (infobar_service)
WebsiteSettingsInfoBarDelegate::Create(infobar_service);
} }
bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { bool FlashPermissionContext::IsRestrictedToSecureOrigins() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment