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

Unified Diff: chrome/browser/extensions/extension_action_runner.h

Issue 1809813002: [Extensions] Show a "refresh" bubble when needed with click-to-script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 4 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
Index: chrome/browser/extensions/extension_action_runner.h
diff --git a/chrome/browser/extensions/extension_action_runner.h b/chrome/browser/extensions/extension_action_runner.h
index d985a28a56f74f1bdb1ec133ef7870e425d2c53e..d260ee027c1c547f94fe1659064ff462097691d0 100644
--- a/chrome/browser/extensions/extension_action_runner.h
+++ b/chrome/browser/extensions/extension_action_runner.h
@@ -15,8 +15,10 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/extension_action.h"
+#include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/blocked_action_type.h"
#include "extensions/browser/extension_registry_observer.h"
@@ -76,8 +78,17 @@ class ExtensionActionRunner : public content::WebContentsObserver,
// Returns true if the given |extension| has any blocked actions.
bool WantsToRun(const Extension* extension);
+ // Runs any blocked actions the extension has, but does not handle any page
+ // refreshes for document_start/webRequest.
+ void RunForTesting(const Extension* extension);
+
int num_page_requests() const { return num_page_requests_; }
+ void set_default_bubble_close_action_for_testing(
+ scoped_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> action) {
+ default_bubble_close_action_for_testing_ = std::move(action);
+ }
+
#if defined(UNIT_TEST)
// Only used in tests.
PermissionsData::AccessType RequiresUserConsentForScriptInjectionForTesting(
@@ -141,6 +152,15 @@ class ExtensionActionRunner : public content::WebContentsObserver,
// Log metrics.
void LogUMA() const;
+ // Shows the bubble to prompt the user to refresh the page to run the blocked
+ // actions for the given |extension|.
+ void ShowBlockedActionBubble(const Extension* extension);
+
+ // Called when the blocked actions bubble is closed.
+ void OnBlockedActionBubbleClosed(
+ const std::string& extension_id,
+ ToolbarActionsBarBubbleDelegate::CloseAction action);
+
// content::WebContentsObserver implementation.
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
@@ -177,9 +197,19 @@ class ExtensionActionRunner : public content::WebContentsObserver,
// should incorporate more fully with ActiveTab.
std::set<std::string> permitted_extensions_;
+ // If true, ignore active tab being granted rather than running pending
+ // actions.
+ bool ignore_active_tab_granted_;
+
+ // If non-null, the bubble action to simulate for testing.
+ scoped_ptr<ToolbarActionsBarBubbleDelegate::CloseAction>
+ default_bubble_close_action_for_testing_;
+
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
+ base::WeakPtrFactory<ExtensionActionRunner> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionActionRunner);
};
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_apitest.cc ('k') | chrome/browser/extensions/extension_action_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698