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