| 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/extension_message_bubble_controller.h" | 5 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // How many extensions to show in the bubble (max). | 29 // How many extensions to show in the bubble (max). |
| 30 const int kMaxExtensionsToShow = 7; | 30 const int kMaxExtensionsToShow = 7; |
| 31 | 31 |
| 32 // Whether or not to ignore the learn more link navigation for testing. | 32 // Whether or not to ignore the learn more link navigation for testing. |
| 33 bool g_should_ignore_learn_more_for_testing = false; | 33 bool g_should_ignore_learn_more_for_testing = false; |
| 34 | 34 |
| 35 using ProfileSetMap = std::map<std::string, std::set<Profile*>>; | 35 using ProfileSetMap = std::map<std::string, std::set<Profile*>>; |
| 36 base::LazyInstance<ProfileSetMap> g_shown_for_profiles = | 36 base::LazyInstance<ProfileSetMap>::DestructorAtExit g_shown_for_profiles = |
| 37 LAZY_INSTANCE_INITIALIZER; | 37 LAZY_INSTANCE_INITIALIZER; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
| 42 // ExtensionMessageBubbleController::Delegate | 42 // ExtensionMessageBubbleController::Delegate |
| 43 | 43 |
| 44 ExtensionMessageBubbleController::Delegate::Delegate(Profile* profile) | 44 ExtensionMessageBubbleController::Delegate::Delegate(Profile* profile) |
| 45 : profile_(profile), | 45 : profile_(profile), |
| 46 service_(ExtensionSystem::Get(profile)->extension_service()), | 46 service_(ExtensionSystem::Get(profile)->extension_service()), |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (delegate_->ClearProfileSetAfterAction()) | 321 if (delegate_->ClearProfileSetAfterAction()) |
| 322 GetProfileSet()->clear(); | 322 GetProfileSet()->clear(); |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 std::set<Profile*>* ExtensionMessageBubbleController::GetProfileSet() { | 326 std::set<Profile*>* ExtensionMessageBubbleController::GetProfileSet() { |
| 327 return &g_shown_for_profiles.Get()[delegate_->GetKey()]; | 327 return &g_shown_for_profiles.Get()[delegate_->GetKey()]; |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace extensions | 330 } // namespace extensions |
| OLD | NEW |