| 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_delegate.h" | 5 #include "chrome/browser/extensions/suspicious_extension_bubble_delegate.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_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
| 17 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
| 18 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 19 #include "grit/components_strings.h" | 19 #include "grit/components_strings.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 | 21 |
| 22 using extensions::ExtensionMessageBubbleController; | 22 using extensions::ExtensionMessageBubbleController; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // Whether the user has been notified about extension being wiped out. | 26 // Whether the user has been notified about extension being wiped out. |
| 27 const char kWipeoutAcknowledged[] = "ack_wiped"; | 27 const char kWipeoutAcknowledged[] = "ack_wiped"; |
| 28 | 28 |
| 29 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles = | |
| 30 LAZY_INSTANCE_INITIALIZER; | |
| 31 | |
| 32 } // namespace | 29 } // namespace |
| 33 | 30 |
| 34 namespace extensions { | 31 namespace extensions { |
| 35 | 32 |
| 36 SuspiciousExtensionBubbleDelegate::SuspiciousExtensionBubbleDelegate( | 33 SuspiciousExtensionBubbleDelegate::SuspiciousExtensionBubbleDelegate( |
| 37 Profile* profile) | 34 Profile* profile) |
| 38 : extensions::ExtensionMessageBubbleController::Delegate(profile) { | 35 : extensions::ExtensionMessageBubbleController::Delegate(profile) { |
| 39 set_acknowledged_flag_pref_name(kWipeoutAcknowledged); | 36 set_acknowledged_flag_pref_name(kWipeoutAcknowledged); |
| 40 } | 37 } |
| 41 | 38 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 "ExtensionBubble.ExtensionWipeoutCount", count); | 122 "ExtensionBubble.ExtensionWipeoutCount", count); |
| 126 } | 123 } |
| 127 | 124 |
| 128 void SuspiciousExtensionBubbleDelegate::LogAction( | 125 void SuspiciousExtensionBubbleDelegate::LogAction( |
| 129 ExtensionMessageBubbleController::BubbleAction action) { | 126 ExtensionMessageBubbleController::BubbleAction action) { |
| 130 UMA_HISTOGRAM_ENUMERATION( | 127 UMA_HISTOGRAM_ENUMERATION( |
| 131 "ExtensionBubble.WipeoutUserSelection", | 128 "ExtensionBubble.WipeoutUserSelection", |
| 132 action, ExtensionMessageBubbleController::ACTION_BOUNDARY); | 129 action, ExtensionMessageBubbleController::ACTION_BOUNDARY); |
| 133 } | 130 } |
| 134 | 131 |
| 135 std::set<Profile*>* SuspiciousExtensionBubbleDelegate::GetProfileSet() { | 132 const char* SuspiciousExtensionBubbleDelegate::GetKey() { |
| 136 return g_shown_for_profiles.Pointer(); | 133 return "SuspiciousExtensionBubbleDelegate"; |
| 137 } | |
| 138 | |
| 139 // static | |
| 140 void SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting() { | |
| 141 g_shown_for_profiles.Get().clear(); | |
| 142 } | 134 } |
| 143 | 135 |
| 144 } // namespace extensions | 136 } // namespace extensions |
| OLD | NEW |