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

Unified Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « extensions/browser/api/runtime/runtime_api.h ('k') | extensions/browser/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/runtime/runtime_api.cc
diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc
index a42e4662ba777350de36fe349bb5d1422e7d1a9a..e62805e674289632f33a1786b7a89eac8b06d478 100644
--- a/extensions/browser/api/runtime/runtime_api.cc
+++ b/extensions/browser/api/runtime/runtime_api.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/api/runtime/runtime_api.h"
+#include <memory>
#include <utility>
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/values.h"
#include "base/version.h"
@@ -113,10 +113,10 @@ void DispatchOnStartupEventImpl(BrowserContext* browser_context,
return;
}
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP,
- runtime::OnStartup::kEventName,
- std::move(event_args)));
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP,
+ runtime::OnStartup::kEventName,
+ std::move(event_args)));
EventRouter::Get(browser_context)
->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -287,7 +287,7 @@ void RuntimeAPI::StorePendingOnInstallInfoToPref(const Extension* extension) {
// |pending_on_install_info| currently only contains a version string. Instead
// of making the pref hold a plain string, we store it as a dictionary value
// so that we can add more stuff to it in the future if necessary.
- scoped_ptr<base::DictionaryValue> pending_on_install_info(
+ std::unique_ptr<base::DictionaryValue> pending_on_install_info(
new base::DictionaryValue());
base::Version previous_version =
delegate_->GetPreviousExtensionVersion(extension);
@@ -346,7 +346,7 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
base::DictionaryValue* info = new base::DictionaryValue();
event_args->Append(info);
if (old_version.IsValid()) {
@@ -359,9 +359,9 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
}
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_INSTALLED,
- runtime::OnInstalled::kEventName,
- std::move(event_args)));
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_INSTALLED,
+ runtime::OnInstalled::kEventName,
+ std::move(event_args)));
event_router->DispatchEventWithLazyListener(extension_id, std::move(event));
if (old_version.IsValid()) {
@@ -369,20 +369,20 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
ExtensionRegistry::Get(context)->enabled_extensions().GetByID(
extension_id);
if (extension && SharedModuleInfo::IsSharedModule(extension)) {
- scoped_ptr<ExtensionSet> dependents =
+ std::unique_ptr<ExtensionSet> dependents =
system->GetDependentExtensions(extension);
for (ExtensionSet::const_iterator i = dependents->begin();
i != dependents->end();
i++) {
- scoped_ptr<base::ListValue> sm_event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> sm_event_args(new base::ListValue());
base::DictionaryValue* sm_info = new base::DictionaryValue();
sm_event_args->Append(sm_info);
sm_info->SetString(kInstallReason, kInstallReasonSharedModuleUpdate);
sm_info->SetString(kInstallPreviousVersion, old_version.GetString());
sm_info->SetString(kInstallId, extension_id);
- scoped_ptr<Event> sm_event(new Event(events::RUNTIME_ON_INSTALLED,
- runtime::OnInstalled::kEventName,
- std::move(sm_event_args)));
+ std::unique_ptr<Event> sm_event(new Event(
+ events::RUNTIME_ON_INSTALLED, runtime::OnInstalled::kEventName,
+ std::move(sm_event_args)));
event_router->DispatchEventWithLazyListener((*i)->id(),
std::move(sm_event));
}
@@ -399,13 +399,13 @@ void RuntimeEventRouter::DispatchOnUpdateAvailableEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(manifest->DeepCopy());
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_UPDATE_AVAILABLE,
- runtime::OnUpdateAvailable::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_UPDATE_AVAILABLE,
+ runtime::OnUpdateAvailable::kEventName,
+ std::move(args)));
event_router->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -416,10 +416,10 @@ void RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE,
runtime::OnBrowserUpdateAvailable::kEventName, std::move(args)));
event_router->BroadcastEvent(std::move(event));
@@ -434,7 +434,7 @@ void RuntimeEventRouter::DispatchOnRestartRequiredEvent(
if (!system)
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::RUNTIME_ON_RESTART_REQUIRED,
runtime::OnRestartRequired::kEventName,
api::runtime::OnRestartRequired::Create(reason)));
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.h ('k') | extensions/browser/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698