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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 months 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
« no previous file with comments | « chrome/browser/extensions/menu_manager.h ('k') | chrome/browser/extensions/menu_manager_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 77a7b9cea99e1f98002f9470adf06becca66a4b3..dfbd8a5030622ed5f8228f01a6d94412b947e579 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -89,11 +89,11 @@ MenuItem::List MenuItemsFromValue(const std::string& extension_id,
return items;
}
-scoped_ptr<base::Value> MenuItemsToValue(const MenuItem::List& items) {
- scoped_ptr<base::ListValue> list(new base::ListValue());
+std::unique_ptr<base::Value> MenuItemsToValue(const MenuItem::List& items) {
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (size_t i = 0; i < items.size(); ++i)
list->Append(items[i]->ToValue().release());
- return scoped_ptr<base::Value>(list.release());
+ return std::unique_ptr<base::Value>(list.release());
}
bool GetStringList(const base::DictionaryValue& dict,
@@ -195,8 +195,8 @@ void MenuItem::AddChild(MenuItem* item) {
children_.push_back(item);
}
-scoped_ptr<base::DictionaryValue> MenuItem::ToValue() const {
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue);
+std::unique_ptr<base::DictionaryValue> MenuItem::ToValue() const {
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
// Should only be called for extensions with event pages, which only have
// string IDs for items.
DCHECK_EQ(0, id_.uid);
@@ -252,8 +252,8 @@ MenuItem* MenuItem::Populate(const std::string& extension_id,
if (!contexts.Populate(*contexts_value))
return NULL;
- scoped_ptr<MenuItem> result(new MenuItem(
- id, title, checked, enabled, type, contexts));
+ std::unique_ptr<MenuItem> result(
+ new MenuItem(id, title, checked, enabled, type, contexts));
std::vector<std::string> document_url_patterns;
if (!GetStringList(value, kDocumentURLPatternsKey, &document_url_patterns))
@@ -270,7 +270,7 @@ MenuItem* MenuItem::Populate(const std::string& extension_id,
// parent_id is filled in from the value, but it might not be valid. It's left
// to be validated upon being added (via AddChildItem) to the menu manager.
- scoped_ptr<Id> parent_id(
+ std::unique_ptr<Id> parent_id(
new Id(incognito, MenuItem::ExtensionKey(extension_id)));
if (value.HasKey(kParentUIDKey)) {
if (!value.GetString(kParentUIDKey, &parent_id->string_uid))
@@ -636,7 +636,7 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
if (item->type() == MenuItem::RADIO)
RadioItemSelected(item);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* properties = new base::DictionaryValue();
SetIdKeyValue(properties, "menuItemId", item->id());
@@ -719,11 +719,11 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
{
// Dispatch to menu item's .onclick handler (this is the legacy API, from
// before chrome.contextMenus.onClicked existed).
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(webview_guest ? events::WEB_VIEW_INTERNAL_CONTEXT_MENUS
: events::CONTEXT_MENUS,
webview_guest ? kOnWebviewContextMenus : kOnContextMenus,
- scoped_ptr<base::ListValue>(args->DeepCopy())));
+ std::unique_ptr<base::ListValue>(args->DeepCopy())));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
event_router->DispatchEventToExtension(item->extension_id(),
@@ -731,7 +731,7 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
}
{
// Dispatch to .contextMenus.onClicked handler.
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
webview_guest ? events::CHROME_WEB_VIEW_INTERNAL_ON_CLICKED
: events::CONTEXT_MENUS_ON_CLICKED,
webview_guest ? api::chrome_web_view_internal::OnClicked::kEventName
@@ -826,7 +826,7 @@ void MenuManager::WriteToStorage(const Extension* extension,
}
void MenuManager::ReadFromStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
const Extension* extension = ExtensionRegistry::Get(browser_context_)
->enabled_extensions()
.GetByID(extension_id);
@@ -842,7 +842,7 @@ void MenuManager::ReadFromStorage(const std::string& extension_id,
// they have not yet been validated. Separate them out here.
// Because of the order in which we store items in the prefs, parents will
// precede children, so we should already know about any parent items.
- scoped_ptr<MenuItem::Id> parent_id;
+ std::unique_ptr<MenuItem::Id> parent_id;
parent_id.swap(items[i]->parent_id_);
added = AddChildItem(*parent_id, items[i]);
} else {
« no previous file with comments | « chrome/browser/extensions/menu_manager.h ('k') | chrome/browser/extensions/menu_manager_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698