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

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

Issue 95133002: Add an extension bubble explaining which extensions are in dev mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'ed Created 7 years 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_message_bubble_controller.h
diff --git a/chrome/browser/extensions/extension_message_bubble_controller.h b/chrome/browser/extensions/extension_message_bubble_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..1452b09717aa4a9fdd34d1eecaecd1ea86caa66d
--- /dev/null
+++ b/chrome/browser/extensions/extension_message_bubble_controller.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_
+
+#include <string>
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/extension_message_bubble.h"
+#include "extensions/common/extension.h"
+
+class Browser;
+class ExtensionService;
+
+namespace extensions {
+
+class ExtensionPrefs;
+class SuspiciousExtensionBubble;
+
+class ExtensionMessageBubbleController {
+ public:
+ ExtensionMessageBubbleController(ExtensionListType type, Profile* profile);
not at google - send to devlin 2013/12/04 17:25:13 Having discrete "list types" like this makes this
+ virtual ~ExtensionMessageBubbleController();
+
+ // Whether the controller knows of extensions to list in the bubble. Returns
+ // true if so.
+ bool HasExtensionList();
+
+ // Obtains a list of all extensions (by name) the controller knows about.
+ std::vector<string16> GetExtensionList() const;
+
+ // Obtains a list of all extensions (by id) the controller knows about.
+ const ExtensionIdList& extension_id_list() const {
+ return extension_list_;
+ }
+
+ // Sets up the callbacks and shows the bubble.
+ void Show(ExtensionMessageBubble* bubble);
+
+ // Whether the bubble is currently showing.
+ bool showing_bubble() { return showing_bubble_; }
+
+ // Text for various UI labels shown in the bubble.
+ string16 GetTitle() const;
+ string16 GetMessageBody() const;
+ string16 GetOverflowText(const string16& overflow_count) const;
+ string16 GetLearnMoreLabel() const;
+ string16 GetActionButtonLabel() const;
+ string16 GetDismissButtonLabel() const;
+ // Whether to show a list of extensions in the bubble.
+ bool ShouldShowExtensionList() const;
+
+ virtual bool ShouldIncludeExtension(const std::string& extension_id) = 0;
+ virtual void AcknowledgeExtension(const std::string& extension_id) = 0;
+ virtual void PerformAction() = 0;
not at google - send to devlin 2013/12/04 17:25:13 the more typical idiom is to define a Delegate for
+
+ // Callbacks from bubble. Declared virtual for testing purposes.
+ virtual void OnBubbleAction();
+ virtual void OnBubbleDismiss();
+ virtual void OnLinkClicked();
+
+ protected:
+ // UMA histogram constants.
+ enum UmaExtensionListHistogramOptions {
+ ACTION_LEARN_MORE = 0,
+ ACTION_EXECUTE,
+ ACTION_DISMISS,
+ ACTION_BOUNDARY, // Must be the last value.
+ };
+
+ // Our extension service. Weak, not owned by us.
+ ExtensionService* service_;
+
+ // A weak pointer to the profile we are associated with. Not owned by us.
+ Profile* profile_;
+
+ // The list of extensions found.
+ ExtensionIdList extension_list_;
+
+ // The action the user took in the bubble.
+ UmaExtensionListHistogramOptions user_action_;
+
+ private:
+
+ // Iterate over the known extensions and acknowledge each one.
+ void AcknowledgeExtensions();
+
+ // Record UMA statistic for the action taken by the user.
+ void RecordAction(UmaExtensionListHistogramOptions action);
+
+ // The type of bubble we are serving data for.
+ ExtensionListType type_;
+
+ // This object only checks once for suspicious extensions because the dataset
+ // doesn't change after startup.
+ bool has_notified_;
+
+ // Whether the bubble is currently showing.
+ bool showing_bubble_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698