| 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/dev_mode_bubble_delegate.h" | 5 #include "chrome/browser/extensions/dev_mode_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 "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.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/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 15 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
| 16 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 17 #include "grit/components_strings.h" | 17 #include "grit/components_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 namespace { |
| 23 |
| 24 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles = |
| 25 LAZY_INSTANCE_INITIALIZER; |
| 26 |
| 27 } // namespace |
| 28 |
| 22 DevModeBubbleDelegate::DevModeBubbleDelegate(Profile* profile) | 29 DevModeBubbleDelegate::DevModeBubbleDelegate(Profile* profile) |
| 23 : ExtensionMessageBubbleController::Delegate(profile) { | 30 : ExtensionMessageBubbleController::Delegate(profile) { |
| 24 } | 31 } |
| 25 | 32 |
| 26 DevModeBubbleDelegate::~DevModeBubbleDelegate() { | 33 DevModeBubbleDelegate::~DevModeBubbleDelegate() { |
| 27 } | 34 } |
| 28 | 35 |
| 29 bool DevModeBubbleDelegate::ShouldIncludeExtension(const Extension* extension) { | 36 bool DevModeBubbleDelegate::ShouldIncludeExtension(const Extension* extension) { |
| 30 return (extension->location() == Manifest::UNPACKED || | 37 return (extension->location() == Manifest::UNPACKED || |
| 31 extension->location() == Manifest::COMMAND_LINE); | 38 extension->location() == Manifest::COMMAND_LINE); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 "ExtensionBubble.ExtensionsInDevModeCount", count); | 98 "ExtensionBubble.ExtensionsInDevModeCount", count); |
| 92 } | 99 } |
| 93 | 100 |
| 94 void DevModeBubbleDelegate::LogAction( | 101 void DevModeBubbleDelegate::LogAction( |
| 95 ExtensionMessageBubbleController::BubbleAction action) { | 102 ExtensionMessageBubbleController::BubbleAction action) { |
| 96 UMA_HISTOGRAM_ENUMERATION( | 103 UMA_HISTOGRAM_ENUMERATION( |
| 97 "ExtensionBubble.DevModeUserSelection", | 104 "ExtensionBubble.DevModeUserSelection", |
| 98 action, ExtensionMessageBubbleController::ACTION_BOUNDARY); | 105 action, ExtensionMessageBubbleController::ACTION_BOUNDARY); |
| 99 } | 106 } |
| 100 | 107 |
| 101 const char* DevModeBubbleDelegate::GetKey() { | 108 std::set<Profile*>* DevModeBubbleDelegate::GetProfileSet() { |
| 102 return "DevModeBubbleDelegate"; | 109 return g_shown_for_profiles.Pointer(); |
| 103 } | 110 } |
| 104 | 111 |
| 105 bool DevModeBubbleDelegate::ClearProfileSetAfterAction() { | 112 // static |
| 106 return false; | 113 void DevModeBubbleDelegate::ClearProfileListForTesting() { |
| 114 g_shown_for_profiles.Get().clear(); |
| 107 } | 115 } |
| 108 | 116 |
| 109 } // namespace extensions | 117 } // namespace extensions |
| OLD | NEW |