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

Unified Diff: chrome/browser/ui/views/extensions/extension_message_bubble_view.h

Issue 1087713002: [Reland] [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finnur's Created 5 years, 8 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/ui/views/extensions/extension_message_bubble_view.h
diff --git a/chrome/browser/ui/views/extensions/extension_message_bubble_view.h b/chrome/browser/ui/views/extensions/extension_message_bubble_view.h
index eadaf716feffa9861002ae7e6e6f9ead6abae0f6..177673fad20e24eb7ea26787d0086124ea753bc1 100644
--- a/chrome/browser/ui/views/extensions/extension_message_bubble_view.h
+++ b/chrome/browser/ui/views/extensions/extension_message_bubble_view.h
@@ -5,18 +5,14 @@
#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
-#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_message_bubble.h"
-#include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/link_listener.h"
class Profile;
-class BrowserActionsContainer;
-class ToolbarView;
namespace views {
class Label;
@@ -26,121 +22,8 @@ class View;
namespace extensions {
-class DevModeBubbleController;
class ExtensionMessageBubbleController;
-// Create and show ExtensionMessageBubbles for either extensions that look
-// suspicious and have therefore been disabled, or for extensions that are
-// running in developer mode that we want to warn the user about.
-// Calling MaybeShow() will show one of the bubbles, if there is cause to (we
-// don't show both in order to avoid spamminess). The suspicious extensions
-// bubble takes priority over the developer mode extensions bubble.
-class ExtensionMessageBubbleFactory : public BrowserActionsContainerObserver {
- public:
- ExtensionMessageBubbleFactory(Profile* profile, ToolbarView* toolbar_view);
- ~ExtensionMessageBubbleFactory() override;
-
- void MaybeShow(views::View* anchor_view);
-
- private:
- // The stage of showing the developer mode extensions bubble. STAGE_START
- // corresponds to the beginning of the process, when nothing has been done.
- // STAGE_HIGHLIGHTED indicates that the toolbar should be highlighting
- // dangerous extensions. STAGE_COMPLETE means that the process should be
- // ended.
- enum Stage { STAGE_START, STAGE_HIGHLIGHTED, STAGE_COMPLETE };
-
- // Shows the suspicious extensions bubble, if there are suspicious extensions
- // and we have not done so already.
- // Returns true if we have show the view.
- bool MaybeShowSuspiciousExtensionsBubble(views::View* anchor_view);
-
- // Shows the settings API extensions bubble, if there are extensions
- // overriding the startup pages and we have not done so already.
- // Returns true if we show the view (or start the process).
- bool MaybeShowStartupOverrideExtensionsBubble(views::View* anchor_view);
-
- // Shows the bubble for when there are extensions overriding the proxy (if we
- // have not done so already). Returns true if we show the view (or start the
- // process of doing so).
- bool MaybeShowProxyOverrideExtensionsBubble(views::View* anchor_view);
-
- // Shows the developer mode extensions bubble, if there are extensions running
- // in developer mode and we have not done so already.
- // Returns true if we show the view (or start the process).
- bool MaybeShowDevModeExtensionsBubble(views::View* anchor_view);
-
- // Starts or stops observing the BrowserActionsContainer, if necessary.
- void MaybeObserve();
- void MaybeStopObserving();
-
- // Adds |profile| to the list of profiles that have been evaluated for showing
- // a bubble. Handy for things that only want to check once per profile.
- void RecordProfileCheck(Profile* profile);
- // Returns false if this profile has been evaluated before.
- bool IsInitialProfileCheck(Profile* profile);
-
- // BrowserActionsContainer::Observer implementation.
- void OnBrowserActionsContainerAnimationEnded() override;
- void OnBrowserActionsContainerDestroyed() override;
-
- // Sets the stage for highlighting extensions and then showing the bubble
- // controlled by |controller|, anchored to |anchor_view|.
- void PrepareToHighlightExtensions(
- scoped_ptr<ExtensionMessageBubbleController> controller,
- views::View* anchor_view);
-
- // Inform the ExtensionToolbarModel to highlight the appropriate extensions.
- void HighlightExtensions();
-
- // Shows the waiting bubbble, after highlighting the extensions.
- void ShowHighlightingBubble();
-
- // Finishes the process of showing the developer mode bubble.
- void Finish();
-
- // The associated profile.
- Profile* profile_;
-
- // The toolbar view that the ExtensionMessageBubbleViews will attach to.
- ToolbarView* toolbar_view_;
-
- // Whether or not we have shown the suspicious extensions bubble.
- bool shown_suspicious_extensions_bubble_;
-
- // Whether or not we have shown the Settings API extensions bubble notifying
- // the user about the startup pages being overridden.
- bool shown_startup_override_extensions_bubble_;
-
- // Whether or not we have shown the bubble notifying the user about the proxy
- // being overridden.
- bool shown_proxy_override_extensions_bubble_;
-
- // Whether or not we have shown the developer mode extensions bubble.
- bool shown_dev_mode_extensions_bubble_;
-
- // Whether or not we are already observing the BrowserActionsContainer (so
- // we don't add ourselves twice).
- bool is_observing_;
-
- // The current stage of showing the bubble.
- Stage stage_;
-
- // The BrowserActionsContainer for the profile. This will be NULL if the
- // factory is not currently in the process of showing a bubble.
- BrowserActionsContainer* container_;
-
- // The default view to anchor the bubble to. This will be NULL if the factory
- // is not currently in the process of showing a bubble.
- views::View* anchor_view_;
-
- // The controller to show a bubble for. This will be NULL if the factory is
- // not currently in the process of showing a bubble.
- scoped_ptr<ExtensionMessageBubbleController> controller_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleFactory);
-};
-
// This is a class that implements the UI for the bubble showing which
// extensions look suspicious and have therefore been automatically disabled.
class ExtensionMessageBubbleView : public ExtensionMessageBubble,
@@ -154,9 +37,6 @@ class ExtensionMessageBubbleView : public ExtensionMessageBubble,
scoped_ptr<ExtensionMessageBubbleController> controller);
// ExtensionMessageBubble methods.
- void OnActionButtonClicked(const base::Closure& callback) override;
- void OnDismissButtonClicked(const base::Closure& callback) override;
- void OnLinkClicked(const base::Closure& callback) override;
void Show() override;
// WidgetObserver methods.
@@ -198,11 +78,6 @@ class ExtensionMessageBubbleView : public ExtensionMessageBubble,
bool link_clicked_;
bool action_taken_;
- // Callbacks into the controller.
- base::Closure action_callback_;
- base::Closure dismiss_callback_;
- base::Closure link_callback_;
-
base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView);

Powered by Google App Engine
This is Rietveld 408576698