| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/settings_api_helpers.h" | 10 #include "chrome/browser/extensions/settings_api_helpers.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 SettingsApiOverrideType type); | 39 SettingsApiOverrideType type); |
| 40 ~SettingsApiBubbleDelegate() override; | 40 ~SettingsApiBubbleDelegate() override; |
| 41 | 41 |
| 42 // ExtensionMessageBubbleController::Delegate methods. | 42 // ExtensionMessageBubbleController::Delegate methods. |
| 43 bool ShouldIncludeExtension(const std::string& extension_id) override; | 43 bool ShouldIncludeExtension(const std::string& extension_id) override; |
| 44 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 void PerformAction(const ExtensionIdList& list) override; | 47 void PerformAction(const ExtensionIdList& list) override; |
| 48 base::string16 GetTitle() const override; | 48 base::string16 GetTitle() const override; |
| 49 base::string16 GetMessageBody(bool anchored_to_browser_action) const override; | 49 base::string16 GetMessageBody(bool anchored_to_browser_action, |
| 50 int extension_count) const override; |
| 50 base::string16 GetOverflowText( | 51 base::string16 GetOverflowText( |
| 51 const base::string16& overflow_count) const override; | 52 const base::string16& overflow_count) const override; |
| 52 GURL GetLearnMoreUrl() const override; | 53 GURL GetLearnMoreUrl() const override; |
| 53 base::string16 GetActionButtonLabel() const override; | 54 base::string16 GetActionButtonLabel() const override; |
| 54 base::string16 GetDismissButtonLabel() const override; | 55 base::string16 GetDismissButtonLabel() const override; |
| 55 bool ShouldShowExtensionList() const override; | 56 bool ShouldShowExtensionList() const override; |
| 56 bool ShouldHighlightExtensions() const override; | 57 bool ShouldHighlightExtensions() const override; |
| 57 void LogExtensionCount(size_t count) override; | 58 void LogExtensionCount(size_t count) override; |
| 58 void LogAction( | 59 void LogAction( |
| 59 ExtensionMessageBubbleController::BubbleAction action) override; | 60 ExtensionMessageBubbleController::BubbleAction action) override; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 IDS_EXTENSIONS_SETTINGS_API_TITLE_STARTUP_PAGES_BUBBLE); | 143 IDS_EXTENSIONS_SETTINGS_API_TITLE_STARTUP_PAGES_BUBBLE); |
| 143 case BUBBLE_TYPE_SEARCH_ENGINE: | 144 case BUBBLE_TYPE_SEARCH_ENGINE: |
| 144 return l10n_util::GetStringUTF16( | 145 return l10n_util::GetStringUTF16( |
| 145 IDS_EXTENSIONS_SETTINGS_API_TITLE_SEARCH_ENGINE_BUBBLE); | 146 IDS_EXTENSIONS_SETTINGS_API_TITLE_SEARCH_ENGINE_BUBBLE); |
| 146 } | 147 } |
| 147 NOTREACHED(); | 148 NOTREACHED(); |
| 148 return base::string16(); | 149 return base::string16(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 base::string16 SettingsApiBubbleDelegate::GetMessageBody( | 152 base::string16 SettingsApiBubbleDelegate::GetMessageBody( |
| 152 bool anchored_to_browser_action) const { | 153 bool anchored_to_browser_action, |
| 154 int extension_count) const { |
| 153 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 155 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
| 154 const Extension* extension = | 156 const Extension* extension = |
| 155 registry->GetExtensionById(extension_id_, ExtensionRegistry::ENABLED); | 157 registry->GetExtensionById(extension_id_, ExtensionRegistry::ENABLED); |
| 156 const SettingsOverrides* settings = | 158 const SettingsOverrides* settings = |
| 157 extension ? SettingsOverrides::Get(extension) : NULL; | 159 extension ? SettingsOverrides::Get(extension) : NULL; |
| 158 if (!extension || !settings) { | 160 if (!extension || !settings) { |
| 159 NOTREACHED(); | 161 NOTREACHED(); |
| 160 return base::string16(); | 162 return base::string16(); |
| 161 } | 163 } |
| 162 | 164 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return true; | 327 return true; |
| 326 } | 328 } |
| 327 | 329 |
| 328 bool SettingsApiBubbleController::CloseOnDeactivate() { | 330 bool SettingsApiBubbleController::CloseOnDeactivate() { |
| 329 // Startup bubbles tend to get lost in the focus storm that happens on | 331 // Startup bubbles tend to get lost in the focus storm that happens on |
| 330 // startup. Other types should dismiss on focus loss. | 332 // startup. Other types should dismiss on focus loss. |
| 331 return type_ != BUBBLE_TYPE_STARTUP_PAGES; | 333 return type_ != BUBBLE_TYPE_STARTUP_PAGES; |
| 332 } | 334 } |
| 333 | 335 |
| 334 } // namespace extensions | 336 } // namespace extensions |
| OLD | NEW |