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