| 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 24 matching lines...) Expand all Loading... |
| 35 explicit SuspiciousExtensionBubbleDelegate(Profile* profile); | 35 explicit SuspiciousExtensionBubbleDelegate(Profile* profile); |
| 36 virtual ~SuspiciousExtensionBubbleDelegate(); | 36 virtual ~SuspiciousExtensionBubbleDelegate(); |
| 37 | 37 |
| 38 // ExtensionMessageBubbleController::Delegate methods. | 38 // ExtensionMessageBubbleController::Delegate methods. |
| 39 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; | 39 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; |
| 40 virtual void AcknowledgeExtension( | 40 virtual void AcknowledgeExtension( |
| 41 const std::string& extension_id, | 41 const std::string& extension_id, |
| 42 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; | 42 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; |
| 43 virtual void PerformAction(const extensions::ExtensionIdList& list) OVERRIDE; | 43 virtual void PerformAction(const extensions::ExtensionIdList& list) OVERRIDE; |
| 44 virtual base::string16 GetTitle() const OVERRIDE; | 44 virtual base::string16 GetTitle() const OVERRIDE; |
| 45 virtual base::string16 GetMessageBody() const OVERRIDE; | 45 virtual base::string16 GetMessageBody( |
| 46 bool anchored_to_browser_action) const OVERRIDE; |
| 46 virtual base::string16 GetOverflowText( | 47 virtual base::string16 GetOverflowText( |
| 47 const base::string16& overflow_count) const OVERRIDE; | 48 const base::string16& overflow_count) const OVERRIDE; |
| 48 virtual base::string16 GetLearnMoreLabel() const OVERRIDE; | 49 virtual base::string16 GetLearnMoreLabel() const OVERRIDE; |
| 49 virtual GURL GetLearnMoreUrl() const OVERRIDE; | 50 virtual GURL GetLearnMoreUrl() const OVERRIDE; |
| 50 virtual base::string16 GetActionButtonLabel() const OVERRIDE; | 51 virtual base::string16 GetActionButtonLabel() const OVERRIDE; |
| 51 virtual base::string16 GetDismissButtonLabel() const OVERRIDE; | 52 virtual base::string16 GetDismissButtonLabel() const OVERRIDE; |
| 52 virtual bool ShouldShowExtensionList() const OVERRIDE; | 53 virtual bool ShouldShowExtensionList() const OVERRIDE; |
| 53 virtual void LogExtensionCount(size_t count) OVERRIDE; | 54 virtual void LogExtensionCount(size_t count) OVERRIDE; |
| 54 virtual void LogAction( | 55 virtual void LogAction( |
| 55 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; | 56 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void SuspiciousExtensionBubbleDelegate::PerformAction( | 92 void SuspiciousExtensionBubbleDelegate::PerformAction( |
| 92 const extensions::ExtensionIdList& list) { | 93 const extensions::ExtensionIdList& list) { |
| 93 // This bubble solicits no action from the user. Or as Nimoy would have it: | 94 // This bubble solicits no action from the user. Or as Nimoy would have it: |
| 94 // "Well, my work here is done". | 95 // "Well, my work here is done". |
| 95 } | 96 } |
| 96 | 97 |
| 97 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const { | 98 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const { |
| 98 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_TITLE); | 99 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_TITLE); |
| 99 } | 100 } |
| 100 | 101 |
| 101 base::string16 SuspiciousExtensionBubbleDelegate::GetMessageBody() const { | 102 base::string16 SuspiciousExtensionBubbleDelegate::GetMessageBody( |
| 103 bool anchored_to_browser_action) const { |
| 102 return l10n_util::GetStringFUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_BODY, | 104 return l10n_util::GetStringFUTF16(IDS_EXTENSIONS_UNSUPPORTED_DISABLED_BODY, |
| 103 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 105 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
| 104 } | 106 } |
| 105 | 107 |
| 106 base::string16 SuspiciousExtensionBubbleDelegate::GetOverflowText( | 108 base::string16 SuspiciousExtensionBubbleDelegate::GetOverflowText( |
| 107 const base::string16& overflow_count) const { | 109 const base::string16& overflow_count) const { |
| 108 return l10n_util::GetStringFUTF16( | 110 return l10n_util::GetStringFUTF16( |
| 109 IDS_EXTENSIONS_DISABLED_AND_N_MORE, | 111 IDS_EXTENSIONS_DISABLED_AND_N_MORE, |
| 110 overflow_count); | 112 overflow_count); |
| 111 } | 113 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && | 175 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && |
| 174 !GetExtensionList().empty(); | 176 !GetExtensionList().empty(); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { | 179 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { |
| 178 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); | 180 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); |
| 179 ExtensionMessageBubbleController::Show(bubble); | 181 ExtensionMessageBubbleController::Show(bubble); |
| 180 } | 182 } |
| 181 | 183 |
| 182 } // namespace extensions | 184 } // namespace extensions |
| OLD | NEW |