| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_action_manager.h" | 5 #include "chrome/browser/extensions/extension_action_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r_factory.h" | 8 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r_factory.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 ExtensionActionManagerFactory* | 55 ExtensionActionManagerFactory* |
| 56 ExtensionActionManagerFactory::GetInstance() { | 56 ExtensionActionManagerFactory::GetInstance() { |
| 57 return base::Singleton<ExtensionActionManagerFactory>::get(); | 57 return base::Singleton<ExtensionActionManagerFactory>::get(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 ExtensionActionManager::ExtensionActionManager(Profile* profile) | 62 ExtensionActionManager::ExtensionActionManager(Profile* profile) |
| 63 : profile_(profile), extension_registry_observer_(this) { | 63 : profile_(profile), extension_registry_observer_(this) { |
| 64 CHECK_EQ(profile, profile->GetOriginalProfile()) | 64 // Don't instantiate this with an incognito profile. |
| 65 << "Don't instantiate this with an incognito profile."; | 65 CHECK_EQ(profile, profile->GetOriginalProfile()); |
| 66 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 66 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 ExtensionActionManager::~ExtensionActionManager() { | 69 ExtensionActionManager::~ExtensionActionManager() { |
| 70 // Don't assert that the ExtensionAction maps are empty because Extensions are | 70 // Don't assert that the ExtensionAction maps are empty because Extensions are |
| 71 // sometimes (only in tests?) not unloaded before the Profile is destroyed. | 71 // sometimes (only in tests?) not unloaded before the Profile is destroyed. |
| 72 } | 72 } |
| 73 | 73 |
| 74 ExtensionActionManager* ExtensionActionManager::Get( | 74 ExtensionActionManager* ExtensionActionManager::Get( |
| 75 content::BrowserContext* context) { | 75 content::BrowserContext* context) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 profile_); | 173 profile_); |
| 174 } | 174 } |
| 175 | 175 |
| 176 ExtensionAction* ExtensionActionManager::GetExtensionAction( | 176 ExtensionAction* ExtensionActionManager::GetExtensionAction( |
| 177 const Extension& extension) const { | 177 const Extension& extension) const { |
| 178 ExtensionAction* action = GetBrowserAction(extension); | 178 ExtensionAction* action = GetBrowserAction(extension); |
| 179 return action ? action : GetPageAction(extension); | 179 return action ? action : GetPageAction(extension); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |