OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Shows the suspicious extensions bubble, if there are suspicious extensions | 53 // Shows the suspicious extensions bubble, if there are suspicious extensions |
54 // and we have not done so already. | 54 // and we have not done so already. |
55 // Returns true if we have show the view. | 55 // Returns true if we have show the view. |
56 bool MaybeShowSuspiciousExtensionsBubble(views::View* anchor_view); | 56 bool MaybeShowSuspiciousExtensionsBubble(views::View* anchor_view); |
57 | 57 |
58 // Shows the settings API extensions bubble, if there are extensions | 58 // Shows the settings API extensions bubble, if there are extensions |
59 // overriding the startup pages and we have not done so already. | 59 // overriding the startup pages and we have not done so already. |
60 // Returns true if we show the view (or start the process). | 60 // Returns true if we show the view (or start the process). |
61 bool MaybeShowStartupOverrideExtensionsBubble(views::View* anchor_view); | 61 bool MaybeShowStartupOverrideExtensionsBubble(views::View* anchor_view); |
62 | 62 |
63 // Shows the bubble for when there are extensions overriding the proxy (if we | |
64 // have not done so already). Returns true if we show the view (or start the | |
65 // process of doing so). | |
66 bool MaybeShowProxyOverrideExtensionsBubble(views::View* anchor_view); | |
67 | |
68 // Shows the developer mode extensions bubble, if there are extensions running | 63 // Shows the developer mode extensions bubble, if there are extensions running |
69 // in developer mode and we have not done so already. | 64 // in developer mode and we have not done so already. |
70 // Returns true if we show the view (or start the process). | 65 // Returns true if we show the view (or start the process). |
71 bool MaybeShowDevModeExtensionsBubble(views::View* anchor_view); | 66 bool MaybeShowDevModeExtensionsBubble(views::View* anchor_view); |
72 | 67 |
73 // Starts or stops observing the BrowserActionsContainer, if necessary. | 68 // Starts or stops observing the BrowserActionsContainer, if necessary. |
74 void MaybeObserve(); | 69 void MaybeObserve(); |
75 void MaybeStopObserving(); | 70 void MaybeStopObserving(); |
76 | 71 |
77 // Adds |profile| to the list of profiles that have been evaluated for showing | 72 // Adds |profile| to the list of profiles that have been evaluated for showing |
78 // a bubble. Handy for things that only want to check once per profile. | 73 // a bubble. Handy for things that only want to check once per profile. |
79 void RecordProfileCheck(Profile* profile); | 74 void RecordProfileCheck(Profile* profile); |
80 // Returns false if this profile has been evaluated before. | 75 // Returns false if this profile has been evaluated before. |
81 bool IsInitialProfileCheck(Profile* profile); | 76 bool IsInitialProfileCheck(Profile* profile); |
82 | 77 |
83 // BrowserActionsContainer::Observer implementation. | 78 // BrowserActionsContainer::Observer implementation. |
84 virtual void OnBrowserActionsContainerAnimationEnded() OVERRIDE; | 79 virtual void OnBrowserActionsContainerAnimationEnded() OVERRIDE; |
85 virtual void OnBrowserActionsContainerDestroyed() OVERRIDE; | 80 virtual void OnBrowserActionsContainerDestroyed() OVERRIDE; |
86 | 81 |
87 // Sets the stage for highlighting extensions and then showing the bubble | 82 // Inform the ExtensionToolbarModel to highlight the appropriate extensions. |
88 // controlled by |controller|, anchored to |anchor_view|. | 83 void HighlightDevModeExtensions(); |
89 void PrepareToHighlightExtensions( | |
90 scoped_ptr<ExtensionMessageBubbleController> controller, | |
91 views::View* anchor_view); | |
92 | 84 |
93 // Inform the ExtensionToolbarModel to highlight the appropriate extensions. | 85 // Shows the developer mode bubble, after highlighting the extensions. |
94 void HighlightExtensions(); | 86 void ShowDevModeBubble(); |
95 | |
96 // Shows the waiting bubbble, after highlighting the extensions. | |
97 void ShowHighlightingBubble(); | |
98 | 87 |
99 // Finishes the process of showing the developer mode bubble. | 88 // Finishes the process of showing the developer mode bubble. |
100 void Finish(); | 89 void Finish(); |
101 | 90 |
102 // The associated profile. | 91 // The associated profile. |
103 Profile* profile_; | 92 Profile* profile_; |
104 | 93 |
105 // The toolbar view that the ExtensionMessageBubbleViews will attach to. | 94 // The toolbar view that the ExtensionMessageBubbleViews will attach to. |
106 ToolbarView* toolbar_view_; | 95 ToolbarView* toolbar_view_; |
107 | 96 |
108 // Whether or not we have shown the suspicious extensions bubble. | 97 // Whether or not we have shown the suspicious extensions bubble. |
109 bool shown_suspicious_extensions_bubble_; | 98 bool shown_suspicious_extensions_bubble_; |
110 | 99 |
111 // Whether or not we have shown the Settings API extensions bubble notifying | 100 // Whether or not we have shown the Settings API extensions bubble notifying |
112 // the user about the startup pages being overridden. | 101 // the user about the startup pages being overridden. |
113 bool shown_startup_override_extensions_bubble_; | 102 bool shown_startup_override_extensions_bubble_; |
114 | 103 |
115 // Whether or not we have shown the bubble notifying the user about the proxy | |
116 // being overridden. | |
117 bool shown_proxy_override_extensions_bubble_; | |
118 | |
119 // Whether or not we have shown the developer mode extensions bubble. | 104 // Whether or not we have shown the developer mode extensions bubble. |
120 bool shown_dev_mode_extensions_bubble_; | 105 bool shown_dev_mode_extensions_bubble_; |
121 | 106 |
122 // Whether or not we are already observing the BrowserActionsContainer (so | 107 // Whether or not we are already observing the BrowserActionsContainer (so |
123 // we don't add ourselves twice). | 108 // we don't add ourselves twice). |
124 bool is_observing_; | 109 bool is_observing_; |
125 | 110 |
126 // The current stage of showing the bubble. | 111 // The current stage of showing the bubble. |
127 Stage stage_; | 112 Stage stage_; |
128 | 113 |
129 // The BrowserActionsContainer for the profile. This will be NULL if the | 114 // The BrowserActionsContainer for the profile. This will be NULL if the |
130 // factory is not currently in the process of showing a bubble. | 115 // factory is not currently in the process of showing a bubble. |
131 BrowserActionsContainer* container_; | 116 BrowserActionsContainer* container_; |
132 | 117 |
133 // The default view to anchor the bubble to. This will be NULL if the factory | 118 // The default view to anchor the bubble to. This will be NULL if the factory |
134 // is not currently in the process of showing a bubble. | 119 // is not currently in the process of showing a bubble. |
135 views::View* anchor_view_; | 120 views::View* anchor_view_; |
136 | 121 |
137 // The controller to show a bubble for. This will be NULL if the factory is | 122 // The DevModeBubbleController to use. This will be NULL if the factory is not |
138 // not currently in the process of showing a bubble. | 123 // currently in the process of showing a bubble. |
139 scoped_ptr<ExtensionMessageBubbleController> controller_; | 124 scoped_ptr<DevModeBubbleController> controller_; |
140 | 125 |
141 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleFactory); | 126 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleFactory); |
142 }; | 127 }; |
143 | 128 |
144 // This is a class that implements the UI for the bubble showing which | 129 // This is a class that implements the UI for the bubble showing which |
145 // extensions look suspicious and have therefore been automatically disabled. | 130 // extensions look suspicious and have therefore been automatically disabled. |
146 class ExtensionMessageBubbleView : public ExtensionMessageBubble, | 131 class ExtensionMessageBubbleView : public ExtensionMessageBubble, |
147 public views::BubbleDelegateView, | 132 public views::BubbleDelegateView, |
148 public views::ButtonListener, | 133 public views::ButtonListener, |
149 public views::LinkListener { | 134 public views::LinkListener { |
(...skipping 30 matching lines...) Expand all Loading... |
180 // views::View implementation. | 165 // views::View implementation. |
181 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 166 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
182 virtual void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) | 167 virtual void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) |
183 OVERRIDE; | 168 OVERRIDE; |
184 | 169 |
185 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; | 170 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; |
186 | 171 |
187 // The controller for this bubble. | 172 // The controller for this bubble. |
188 scoped_ptr<ExtensionMessageBubbleController> controller_; | 173 scoped_ptr<ExtensionMessageBubbleController> controller_; |
189 | 174 |
190 // The view this bubble is anchored against. | |
191 views::View* anchor_view_; | |
192 | |
193 // The headline, labels and buttons on the bubble. | 175 // The headline, labels and buttons on the bubble. |
194 views::Label* headline_; | 176 views::Label* headline_; |
195 views::Link* learn_more_; | 177 views::Link* learn_more_; |
196 views::LabelButton* action_button_; | 178 views::LabelButton* action_button_; |
197 views::LabelButton* dismiss_button_; | 179 views::LabelButton* dismiss_button_; |
198 | 180 |
199 // All actions (link, button, esc) close the bubble, but we need to | 181 // All actions (link, button, esc) close the bubble, but we need to |
200 // make sure we don't send dismiss if the link was clicked. | 182 // make sure we don't send dismiss if the link was clicked. |
201 bool link_clicked_; | 183 bool link_clicked_; |
202 bool action_taken_; | 184 bool action_taken_; |
203 | 185 |
204 // Callbacks into the controller. | 186 // Callbacks into the controller. |
205 base::Closure action_callback_; | 187 base::Closure action_callback_; |
206 base::Closure dismiss_callback_; | 188 base::Closure dismiss_callback_; |
207 base::Closure link_callback_; | 189 base::Closure link_callback_; |
208 | 190 |
209 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); | 191 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); |
210 }; | 192 }; |
211 | 193 |
212 } // namespace extensions | 194 } // namespace extensions |
213 | 195 |
214 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ | 196 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ |
OLD | NEW |