| 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_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 14 #include "chrome/browser/ui/browser_list_observer.h" | 14 #include "chrome/browser/ui/browser_list_observer.h" |
| 15 #include "extensions/browser/browser_context_keyed_api_factory.h" | 15 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 16 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
| 17 | 17 |
| 18 class Browser; | 18 class Browser; |
| 19 class BrowserList; | 19 class BrowserList; |
| 20 class ExtensionService; | 20 class ExtensionService; |
| 21 class ToolbarActionsModel; |
| 21 class Profile; | 22 class Profile; |
| 22 | 23 |
| 23 namespace extensions { | 24 namespace extensions { |
| 24 | 25 |
| 25 class ExtensionPrefs; | 26 class ExtensionPrefs; |
| 26 class ExtensionRegistry; | 27 class ExtensionRegistry; |
| 27 | 28 |
| 28 class ExtensionMessageBubbleController : public chrome::BrowserListObserver { | 29 class ExtensionMessageBubbleController : public chrome::BrowserListObserver { |
| 29 public: | 30 public: |
| 30 // UMA histogram constants. | 31 // UMA histogram constants. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 154 |
| 154 // Called when the bubble is actually shown. Because some bubbles are delayed | 155 // Called when the bubble is actually shown. Because some bubbles are delayed |
| 155 // (in order to weather the "focus storm"), they are not shown immediately. | 156 // (in order to weather the "focus storm"), they are not shown immediately. |
| 156 void OnShown(); | 157 void OnShown(); |
| 157 | 158 |
| 158 // Callbacks from bubble. Declared virtual for testing purposes. | 159 // Callbacks from bubble. Declared virtual for testing purposes. |
| 159 virtual void OnBubbleAction(); | 160 virtual void OnBubbleAction(); |
| 160 virtual void OnBubbleDismiss(bool dismissed_by_deactivation); | 161 virtual void OnBubbleDismiss(bool dismissed_by_deactivation); |
| 161 virtual void OnLinkClicked(); | 162 virtual void OnLinkClicked(); |
| 162 | 163 |
| 164 // Sets this bubble as the active bubble being shown. |
| 165 void SetIsActiveBubble(); |
| 166 |
| 163 void ClearProfileListForTesting(); | 167 void ClearProfileListForTesting(); |
| 164 | 168 |
| 165 static void set_should_ignore_learn_more_for_testing( | 169 static void set_should_ignore_learn_more_for_testing( |
| 166 bool should_ignore_learn_more); | 170 bool should_ignore_learn_more); |
| 167 | 171 |
| 168 private: | 172 private: |
| 169 // BrowserListObserver: | 173 // BrowserListObserver: |
| 170 void OnBrowserRemoved(Browser* browser) override; | 174 void OnBrowserRemoved(Browser* browser) override; |
| 171 | 175 |
| 172 // Iterate over the known extensions and acknowledge each one. | 176 // Iterate over the known extensions and acknowledge each one. |
| 173 void AcknowledgeExtensions(); | 177 void AcknowledgeExtensions(); |
| 174 | 178 |
| 175 // Get the data this class needs. | 179 // Get the data this class needs. |
| 176 ExtensionIdList* GetOrCreateExtensionList(); | 180 ExtensionIdList* GetOrCreateExtensionList(); |
| 177 | 181 |
| 178 // Performs cleanup after the bubble closes. | 182 // Performs cleanup after the bubble closes. |
| 179 void OnClose(); | 183 void OnClose(); |
| 180 | 184 |
| 181 std::set<Profile*>* GetProfileSet(); | 185 std::set<Profile*>* GetProfileSet(); |
| 182 | 186 |
| 183 // A weak pointer to the Browser we are associated with. Not owned by us. | 187 // A weak pointer to the Browser we are associated with. Not owned by us. |
| 184 Browser* browser_; | 188 Browser* browser_; |
| 185 | 189 |
| 190 // The associated ToolbarActionsModel. Not owned. |
| 191 ToolbarActionsModel* model_; |
| 192 |
| 186 // The list of extensions found. | 193 // The list of extensions found. |
| 187 ExtensionIdList extension_list_; | 194 ExtensionIdList extension_list_; |
| 188 | 195 |
| 189 // The action the user took in the bubble. | 196 // The action the user took in the bubble. |
| 190 BubbleAction user_action_; | 197 BubbleAction user_action_; |
| 191 | 198 |
| 192 // Our delegate supplying information about what to show in the dialog. | 199 // Our delegate supplying information about what to show in the dialog. |
| 193 std::unique_ptr<Delegate> delegate_; | 200 std::unique_ptr<Delegate> delegate_; |
| 194 | 201 |
| 195 // Whether this class has initialized. | 202 // Whether this class has initialized. |
| 196 bool initialized_; | 203 bool initialized_; |
| 197 | 204 |
| 198 // Whether or not the bubble is highlighting extensions. | 205 // Whether or not the bubble is highlighting extensions. |
| 199 bool did_highlight_; | 206 bool is_highlighting_; |
| 207 |
| 208 // Whether or not this bubble is the active bubble being shown. |
| 209 bool is_active_bubble_; |
| 200 | 210 |
| 201 ScopedObserver<BrowserList, BrowserListObserver> browser_list_observer_; | 211 ScopedObserver<BrowserList, BrowserListObserver> browser_list_observer_; |
| 202 | 212 |
| 203 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController); | 213 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController); |
| 204 }; | 214 }; |
| 205 | 215 |
| 206 } // namespace extensions | 216 } // namespace extensions |
| 207 | 217 |
| 208 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 218 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |