Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4685)

Unified Diff: chrome/browser/extensions/extension_action_manager.cc

Issue 2466523002: Remove some linked_ptr c/b/extension (Closed)
Patch Set: review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_action_manager.cc
diff --git a/chrome/browser/extensions/extension_action_manager.cc b/chrome/browser/extensions/extension_action_manager.cc
index fe476fadb4c0237af5395422bd78da5d36fc842f..6d197c9046067590785fb780f6053df66dd2aa7f 100644
--- a/chrome/browser/extensions/extension_action_manager.cc
+++ b/chrome/browser/extensions/extension_action_manager.cc
@@ -85,33 +85,33 @@ void ExtensionActionManager::OnExtensionUnloaded(
namespace {
// Returns map[extension_id] if that entry exists. Otherwise, if
-// action_info!=NULL, creates an ExtensionAction from it, fills in the map, and
-// returns that. Otherwise (action_info==NULL), returns NULL.
+// action_info!=nullptr, creates an ExtensionAction from it, fills in the map,
+// and returns that. Otherwise (action_info==nullptr), returns nullptr.
ExtensionAction* GetOrCreateOrNull(
- std::map<std::string, linked_ptr<ExtensionAction> >* map,
+ std::map<std::string, std::unique_ptr<ExtensionAction>>* map,
const Extension& extension,
ActionInfo::Type action_type,
const ActionInfo* action_info,
Profile* profile) {
- std::map<std::string, linked_ptr<ExtensionAction> >::const_iterator it =
- map->find(extension.id());
+ auto it = map->find(extension.id());
if (it != map->end())
return it->second.get();
if (!action_info)
- return NULL;
+ return nullptr;
// Only create action info for enabled extensions.
// This avoids bugs where actions are recreated just after being removed
// in response to OnExtensionUnloaded().
if (!ExtensionRegistry::Get(profile)
->enabled_extensions().Contains(extension.id())) {
- return NULL;
+ return nullptr;
}
- linked_ptr<ExtensionAction> action(new ExtensionAction(
- extension, action_type, *action_info));
- (*map)[extension.id()] = action;
- return action.get();
+ std::unique_ptr<ExtensionAction> action(
+ new ExtensionAction(extension, action_type, *action_info));
+ ExtensionAction* raw_action = action.get();
+ (*map)[extension.id()] = std::move(action);
+ return raw_action;
}
} // namespace
@@ -143,9 +143,8 @@ std::unique_ptr<ExtensionAction> ExtensionActionManager::GetBestFitAction(
// If no ActionInfo exists for |extension|, create and return a new action
// with a blank ActionInfo.
// Populate any missing values from |extension|'s manifest.
- std::unique_ptr<ExtensionAction> new_action(
- new ExtensionAction(extension, type, info ? *info : ActionInfo()));
- return new_action;
+ return base::MakeUnique<ExtensionAction>(extension, type,
+ info ? *info : ActionInfo());
}
ExtensionAction* ExtensionActionManager::GetSystemIndicator(
@@ -155,7 +154,7 @@ ExtensionAction* ExtensionActionManager::GetSystemIndicator(
// unavailable on the current system. If so, return NULL to signal that
// the system indicator area is unusable.
if (!SystemIndicatorManagerFactory::GetForProfile(profile_))
- return NULL;
+ return nullptr;
return GetOrCreateOrNull(&system_indicators_, extension,
ActionInfo::TYPE_SYSTEM_INDICATOR,
« no previous file with comments | « chrome/browser/extensions/extension_action_manager.h ('k') | chrome/browser/extensions/extension_action_runner_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698