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