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

Side by Side 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: Fix compile error 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_
7
8 #include <string>
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
10 #include "chrome/browser/extensions/extension_message_bubble.h"
11 #include "extensions/common/extension.h"
12
13 class Browser;
14 class ExtensionService;
15
16 namespace extensions {
17
18 class ExtensionPrefs;
19 class SuspiciousExtensionBubble;
20
21 class ExtensionMessageBubbleController {
22 public:
23 // UMA histogram constants.
24 enum BubbleAction {
25 ACTION_LEARN_MORE = 0,
26 ACTION_EXECUTE,
27 ACTION_DISMISS,
28 ACTION_BOUNDARY, // Must be the last value.
29 };
30
31 class Delegate {
32 public:
33 virtual void Show(ExtensionMessageBubble* bubble) = 0;
34 virtual bool ShowingBubble() const = 0;
35 virtual bool HasExtensionList() const = 0;
36 virtual std::vector<string16> GetExtensionList() const = 0;
37 virtual const ExtensionIdList& GetExtensionIdList() const = 0;
not at google - send to devlin 2013/12/10 01:21:39 is this used?
Finnur 2013/12/11 23:12:18 It was used in the last CL but no longer. Removed.
38 virtual bool ShouldIncludeExtension(const std::string& extension_id) = 0;
39 virtual void AcknowledgeExtension(
40 const std::string& extension_id,
41 BubbleAction action) = 0;
42 virtual void PerformAction(const ExtensionIdList& list) = 0;
43
44 // Text for various UI labels shown in the bubble.
45 virtual string16 GetTitle() const = 0;
46 virtual string16 GetMessageBody() const = 0;
47 virtual string16 GetOverflowText(const string16& overflow_count) const = 0;
48 virtual string16 GetLearnMoreLabel() const = 0;
49 virtual GURL GetLearnMoreUrl() const = 0;
50 virtual string16 GetActionButtonLabel() const = 0;
51 virtual string16 GetDismissButtonLabel() const = 0;
52
53 // Whether to show a list of extensions in the bubble.
54 virtual bool ShouldShowExtensionList() const = 0;
not at google - send to devlin 2013/12/10 01:21:39 this seems to always return true, also, it doesn't
Finnur 2013/12/11 23:12:18 It is used in the view. The decision has been goi
55
56 // Record, through UMA, how many extensions were found.
57 virtual void LogExtensionCount(size_t count) = 0;
58 virtual void LogAction(BubbleAction action) = 0;
59 };
60
61 ExtensionMessageBubbleController(Delegate* delegate, Profile* profile);
62 virtual ~ExtensionMessageBubbleController();
63
64 // Whether the controller knows of extensions to list in the bubble. Returns
65 // true if so.
66 bool HasExtensionList();
67
68 // Obtains a list of all extensions (by name) the controller knows about.
69 std::vector<string16> GetExtensionList() const;
70
71 // Obtains a list of all extensions (by id) the controller knows about.
72 const ExtensionIdList& extension_id_list() const {
73 return extension_list_;
74 }
75
76 // Sets up the callbacks and shows the bubble.
77 void Show(ExtensionMessageBubble* bubble);
78
79 // Whether the bubble is currently showing.
80 bool showing_bubble() { return showing_bubble_; }
81
82 // Callbacks from bubble. Declared virtual for testing purposes.
83 virtual void OnBubbleAction();
84 virtual void OnBubbleDismiss();
85 virtual void OnLinkClicked();
86
87 // Iterate over the known extensions and acknowledge each one.
88 void AcknowledgeExtensions();
89
90 // Our extension service. Weak, not owned by us.
91 ExtensionService* service_;
92
93 // A weak pointer to the profile we are associated with. Not owned by us.
94 Profile* profile_;
95
96 // The list of extensions found.
97 ExtensionIdList extension_list_;
98
99 // The action the user took in the bubble.
100 BubbleAction user_action_;
101
102 Delegate* delegate_;
103
104 // This object only checks once for suspicious extensions because the dataset
105 // doesn't change after startup.
106 bool has_notified_;
107
108 // Whether the bubble is currently showing.
109 bool showing_bubble_;
110
111 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController);
112 };
113
114 } // namespace extensions
115
116 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698