| 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 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" | 5 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_message_bubble.h" | 10 #include "chrome/browser/extensions/extension_message_bubble.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 explicit SuspiciousExtensionBubbleDelegate(Profile* profile); | 39 explicit SuspiciousExtensionBubbleDelegate(Profile* profile); |
| 40 ~SuspiciousExtensionBubbleDelegate() override; | 40 ~SuspiciousExtensionBubbleDelegate() 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 extensions::ExtensionIdList& list) override; | 47 void PerformAction(const extensions::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 bool for_single_extension) 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const extensions::ExtensionIdList& list) { | 95 const extensions::ExtensionIdList& list) { |
| 95 // This bubble solicits no action from the user. Or as Nimoy would have it: | 96 // This bubble solicits no action from the user. Or as Nimoy would have it: |
| 96 // "Well, my work here is done". | 97 // "Well, my work here is done". |
| 97 } | 98 } |
| 98 | 99 |
| 99 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const { | 100 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const { |
| 100 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_TITLE); | 101 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_TITLE); |
| 101 } | 102 } |
| 102 | 103 |
| 103 base::string16 SuspiciousExtensionBubbleDelegate::GetMessageBody( | 104 base::string16 SuspiciousExtensionBubbleDelegate::GetMessageBody( |
| 104 bool anchored_to_browser_action) const { | 105 bool anchored_to_browser_action, |
| 105 return l10n_util::GetStringFUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_BODY, | 106 bool for_single_extension) const { |
| 106 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 107 int message_id = for_single_extension ? |
| 108 IDS_EXTENSIONS_SINGLE_UNSUPPORTED_DISABLED_BODY : |
| 109 IDS_EXTENSIONS_MULTIPLE_UNSUPPORTED_DISABLED_BODY; |
| 110 return l10n_util::GetStringFUTF16( |
| 111 message_id, l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
| 107 } | 112 } |
| 108 | 113 |
| 109 base::string16 SuspiciousExtensionBubbleDelegate::GetOverflowText( | 114 base::string16 SuspiciousExtensionBubbleDelegate::GetOverflowText( |
| 110 const base::string16& overflow_count) const { | 115 const base::string16& overflow_count) const { |
| 111 return l10n_util::GetStringFUTF16( | 116 return l10n_util::GetStringFUTF16( |
| 112 IDS_EXTENSIONS_DISABLED_AND_N_MORE, | 117 IDS_EXTENSIONS_DISABLED_AND_N_MORE, |
| 113 overflow_count); | 118 overflow_count); |
| 114 } | 119 } |
| 115 | 120 |
| 116 GURL SuspiciousExtensionBubbleDelegate::GetLearnMoreUrl() const { | 121 GURL SuspiciousExtensionBubbleDelegate::GetLearnMoreUrl() const { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && | 179 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && |
| 175 !GetExtensionList().empty(); | 180 !GetExtensionList().empty(); |
| 176 } | 181 } |
| 177 | 182 |
| 178 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { | 183 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { |
| 179 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); | 184 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); |
| 180 ExtensionMessageBubbleController::Show(bubble); | 185 ExtensionMessageBubbleController::Show(bubble); |
| 181 } | 186 } |
| 182 | 187 |
| 183 } // namespace extensions | 188 } // namespace extensions |
| OLD | NEW |