| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include "chrome/browser/extensions/settings_api_bubble_controller.h" | 5 #include "chrome/browser/extensions/settings_api_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_toolbar_model.h" | 9 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 10 #include "chrome/browser/extensions/settings_api_helpers.h" | 10 #include "chrome/browser/extensions/settings_api_helpers.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
| 32 // SettingsApiBubbleDelegate | 32 // SettingsApiBubbleDelegate |
| 33 | 33 |
| 34 class SettingsApiBubbleDelegate | 34 class SettingsApiBubbleDelegate |
| 35 : public ExtensionMessageBubbleController::Delegate { | 35 : public ExtensionMessageBubbleController::Delegate { |
| 36 public: | 36 public: |
| 37 explicit SettingsApiBubbleDelegate(ExtensionService* service, | 37 explicit SettingsApiBubbleDelegate(ExtensionService* service, |
| 38 Profile* profile, | 38 Profile* profile, |
| 39 SettingsApiOverrideType type); | 39 SettingsApiOverrideType type); |
| 40 virtual ~SettingsApiBubbleDelegate(); | 40 ~SettingsApiBubbleDelegate() override; |
| 41 | 41 |
| 42 // ExtensionMessageBubbleController::Delegate methods. | 42 // ExtensionMessageBubbleController::Delegate methods. |
| 43 virtual bool ShouldIncludeExtension(const std::string& extension_id) override; | 43 bool ShouldIncludeExtension(const std::string& extension_id) override; |
| 44 virtual void AcknowledgeExtension( | 44 void AcknowledgeExtension( |
| 45 const std::string& extension_id, | 45 const std::string& extension_id, |
| 46 ExtensionMessageBubbleController::BubbleAction user_action) override; | 46 ExtensionMessageBubbleController::BubbleAction user_action) override; |
| 47 virtual void PerformAction(const ExtensionIdList& list) override; | 47 void PerformAction(const ExtensionIdList& list) override; |
| 48 virtual void OnClose() override; | 48 void OnClose() override; |
| 49 virtual base::string16 GetTitle() const override; | 49 base::string16 GetTitle() const override; |
| 50 virtual base::string16 GetMessageBody( | 50 base::string16 GetMessageBody(bool anchored_to_browser_action) const override; |
| 51 bool anchored_to_browser_action) const override; | 51 base::string16 GetOverflowText( |
| 52 virtual base::string16 GetOverflowText( | |
| 53 const base::string16& overflow_count) const override; | 52 const base::string16& overflow_count) const override; |
| 54 virtual GURL GetLearnMoreUrl() const override; | 53 GURL GetLearnMoreUrl() const override; |
| 55 virtual base::string16 GetActionButtonLabel() const override; | 54 base::string16 GetActionButtonLabel() const override; |
| 56 virtual base::string16 GetDismissButtonLabel() const override; | 55 base::string16 GetDismissButtonLabel() const override; |
| 57 virtual bool ShouldShowExtensionList() const override; | 56 bool ShouldShowExtensionList() const override; |
| 58 virtual void LogExtensionCount(size_t count) override; | 57 void LogExtensionCount(size_t count) override; |
| 59 virtual void LogAction( | 58 void LogAction( |
| 60 ExtensionMessageBubbleController::BubbleAction action) override; | 59 ExtensionMessageBubbleController::BubbleAction action) override; |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 // Our extension service. Weak, not owned by us. | 62 // Our extension service. Weak, not owned by us. |
| 64 ExtensionService* service_; | 63 ExtensionService* service_; |
| 65 | 64 |
| 66 // A weak pointer to the profile we are associated with. Not owned by us. | 65 // A weak pointer to the profile we are associated with. Not owned by us. |
| 67 Profile* profile_; | 66 Profile* profile_; |
| 68 | 67 |
| 69 // The type of settings override this bubble will report on. This can be, for | 68 // The type of settings override this bubble will report on. This can be, for |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return true; | 305 return true; |
| 307 } | 306 } |
| 308 | 307 |
| 309 bool SettingsApiBubbleController::CloseOnDeactivate() { | 308 bool SettingsApiBubbleController::CloseOnDeactivate() { |
| 310 // Startup bubbles tend to get lost in the focus storm that happens on | 309 // Startup bubbles tend to get lost in the focus storm that happens on |
| 311 // startup. Other types should dismiss on focus loss. | 310 // startup. Other types should dismiss on focus loss. |
| 312 return type_ != BUBBLE_TYPE_STARTUP_PAGES; | 311 return type_ != BUBBLE_TYPE_STARTUP_PAGES; |
| 313 } | 312 } |
| 314 | 313 |
| 315 } // namespace extensions | 314 } // namespace extensions |
| OLD | NEW |