Index: extensions/renderer/dispatcher.cc |
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc |
index a1ac15457980ab6466bc9d698eeb32689f9e5730..147fb50837875a0004af861b67baf6b2aa7e3222 100644 |
--- a/extensions/renderer/dispatcher.cc |
+++ b/extensions/renderer/dispatcher.cc |
@@ -6,6 +6,7 @@ |
#include <stddef.h> |
+#include <memory> |
#include <utility> |
#include "base/bind.h" |
@@ -15,7 +16,7 @@ |
#include "base/debug/alias.h" |
#include "base/lazy_instance.h" |
#include "base/macros.h" |
-#include "base/memory/scoped_ptr.h" |
+#include "base/memory/ptr_util.h" |
#include "base/metrics/histogram_macros.h" |
#include "base/metrics/user_metrics_action.h" |
#include "base/strings/string_piece.h" |
@@ -168,7 +169,7 @@ void CallModuleMethod(const std::string& module_name, |
v8::HandleScope handle_scope(context->isolate()); |
v8::Context::Scope context_scope(context->v8_context()); |
- scoped_ptr<content::V8ValueConverter> converter( |
+ std::unique_ptr<content::V8ValueConverter> converter( |
content::V8ValueConverter::create()); |
std::vector<v8::Local<v8::Value>> arguments; |
@@ -318,7 +319,7 @@ void Dispatcher::DidCreateScriptContext( |
InitOriginPermissions(context->extension()); |
{ |
- scoped_ptr<ModuleSystem> module_system( |
+ std::unique_ptr<ModuleSystem> module_system( |
new ModuleSystem(context, &source_map_)); |
context->set_module_system(std::move(module_system)); |
} |
@@ -432,7 +433,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( |
extension, Feature::SERVICE_WORKER_CONTEXT); |
context->set_url(url); |
- g_worker_script_context_set.Get().Insert(make_scoped_ptr(context)); |
+ g_worker_script_context_set.Get().Insert(base::WrapUnique(context)); |
v8::Isolate* isolate = context->isolate(); |
@@ -596,7 +597,7 @@ void Dispatcher::InvokeModuleSystemMethod(content::RenderFrame* render_frame, |
const std::string& function_name, |
const base::ListValue& args, |
bool user_gesture) { |
- scoped_ptr<WebScopedUserGesture> web_user_gesture; |
+ std::unique_ptr<WebScopedUserGesture> web_user_gesture; |
if (user_gesture) |
web_user_gesture.reset(new WebScopedUserGesture); |
@@ -819,80 +820,81 @@ void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, |
RequestSender* request_sender, |
V8SchemaRegistry* v8_schema_registry) { |
module_system->RegisterNativeHandler( |
- "chrome", scoped_ptr<NativeHandler>(new ChromeNativeHandler(context))); |
+ "chrome", |
+ std::unique_ptr<NativeHandler>(new ChromeNativeHandler(context))); |
module_system->RegisterNativeHandler( |
- "logging", scoped_ptr<NativeHandler>(new LoggingNativeHandler(context))); |
+ "logging", |
+ std::unique_ptr<NativeHandler>(new LoggingNativeHandler(context))); |
module_system->RegisterNativeHandler("schema_registry", |
v8_schema_registry->AsNativeHandler()); |
module_system->RegisterNativeHandler( |
"test_features", |
- scoped_ptr<NativeHandler>(new TestFeaturesNativeHandler(context))); |
+ std::unique_ptr<NativeHandler>(new TestFeaturesNativeHandler(context))); |
module_system->RegisterNativeHandler( |
"test_native_handler", |
- scoped_ptr<NativeHandler>(new TestNativeHandler(context))); |
+ std::unique_ptr<NativeHandler>(new TestNativeHandler(context))); |
module_system->RegisterNativeHandler( |
"user_gestures", |
- scoped_ptr<NativeHandler>(new UserGesturesNativeHandler(context))); |
+ std::unique_ptr<NativeHandler>(new UserGesturesNativeHandler(context))); |
module_system->RegisterNativeHandler( |
- "utils", scoped_ptr<NativeHandler>(new UtilsNativeHandler(context))); |
+ "utils", std::unique_ptr<NativeHandler>(new UtilsNativeHandler(context))); |
module_system->RegisterNativeHandler( |
"v8_context", |
- scoped_ptr<NativeHandler>(new V8ContextNativeHandler(context))); |
+ std::unique_ptr<NativeHandler>(new V8ContextNativeHandler(context))); |
module_system->RegisterNativeHandler( |
- "event_natives", scoped_ptr<NativeHandler>(new EventBindings(context))); |
+ "event_natives", |
+ std::unique_ptr<NativeHandler>(new EventBindings(context))); |
module_system->RegisterNativeHandler( |
- "messaging_natives", |
- scoped_ptr<NativeHandler>(MessagingBindings::Get(dispatcher, context))); |
+ "messaging_natives", std::unique_ptr<NativeHandler>( |
+ MessagingBindings::Get(dispatcher, context))); |
module_system->RegisterNativeHandler( |
- "apiDefinitions", |
- scoped_ptr<NativeHandler>( |
- new ApiDefinitionsNatives(dispatcher, context))); |
+ "apiDefinitions", std::unique_ptr<NativeHandler>( |
+ new ApiDefinitionsNatives(dispatcher, context))); |
module_system->RegisterNativeHandler( |
- "sendRequest", |
- scoped_ptr<NativeHandler>( |
- new SendRequestNatives(request_sender, context))); |
+ "sendRequest", std::unique_ptr<NativeHandler>( |
+ new SendRequestNatives(request_sender, context))); |
module_system->RegisterNativeHandler( |
- "setIcon", |
- scoped_ptr<NativeHandler>(new SetIconNatives(context))); |
+ "setIcon", std::unique_ptr<NativeHandler>(new SetIconNatives(context))); |
module_system->RegisterNativeHandler( |
"activityLogger", |
- scoped_ptr<NativeHandler>(new APIActivityLogger(context))); |
+ std::unique_ptr<NativeHandler>(new APIActivityLogger(context))); |
module_system->RegisterNativeHandler( |
"renderFrameObserverNatives", |
- scoped_ptr<NativeHandler>(new RenderFrameObserverNatives(context))); |
+ std::unique_ptr<NativeHandler>(new RenderFrameObserverNatives(context))); |
// Natives used by multiple APIs. |
module_system->RegisterNativeHandler( |
"file_system_natives", |
- scoped_ptr<NativeHandler>(new FileSystemNatives(context))); |
+ std::unique_ptr<NativeHandler>(new FileSystemNatives(context))); |
// Custom bindings. |
module_system->RegisterNativeHandler( |
"app_window_natives", |
- scoped_ptr<NativeHandler>(new AppWindowCustomBindings(context))); |
+ std::unique_ptr<NativeHandler>(new AppWindowCustomBindings(context))); |
module_system->RegisterNativeHandler( |
"blob_natives", |
- scoped_ptr<NativeHandler>(new BlobNativeHandler(context))); |
+ std::unique_ptr<NativeHandler>(new BlobNativeHandler(context))); |
module_system->RegisterNativeHandler( |
"context_menus", |
- scoped_ptr<NativeHandler>(new ContextMenusCustomBindings(context))); |
+ std::unique_ptr<NativeHandler>(new ContextMenusCustomBindings(context))); |
module_system->RegisterNativeHandler( |
- "css_natives", scoped_ptr<NativeHandler>(new CssNativeHandler(context))); |
+ "css_natives", |
+ std::unique_ptr<NativeHandler>(new CssNativeHandler(context))); |
module_system->RegisterNativeHandler( |
"document_natives", |
- scoped_ptr<NativeHandler>(new DocumentCustomBindings(context))); |
+ std::unique_ptr<NativeHandler>(new DocumentCustomBindings(context))); |
module_system->RegisterNativeHandler( |
- "guest_view_internal", |
- scoped_ptr<NativeHandler>( |
- new GuestViewInternalCustomBindings(context))); |
+ "guest_view_internal", std::unique_ptr<NativeHandler>( |
+ new GuestViewInternalCustomBindings(context))); |
module_system->RegisterNativeHandler( |
"id_generator", |
- scoped_ptr<NativeHandler>(new IdGeneratorCustomBindings(context))); |
+ std::unique_ptr<NativeHandler>(new IdGeneratorCustomBindings(context))); |
module_system->RegisterNativeHandler( |
- "runtime", scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
+ "runtime", |
+ std::unique_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
module_system->RegisterNativeHandler( |
"display_source", |
- scoped_ptr<NativeHandler>(new DisplaySourceCustomBindings(context))); |
+ std::unique_ptr<NativeHandler>(new DisplaySourceCustomBindings(context))); |
} |
bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { |
@@ -995,7 +997,7 @@ void Dispatcher::OnCancelSuspend(const std::string& extension_id) { |
} |
void Dispatcher::OnDeliverMessage(int target_port_id, const Message& message) { |
- scoped_ptr<RequestSender::ScopedTabID> scoped_tab_id; |
+ std::unique_ptr<RequestSender::ScopedTabID> scoped_tab_id; |
std::map<int, int>::const_iterator it = |
port_to_tab_id_map_.find(target_port_id); |
if (it != port_to_tab_id_map_.end()) { |
@@ -1161,9 +1163,9 @@ void Dispatcher::OnUpdatePermissions( |
if (!extension) |
return; |
- scoped_ptr<const PermissionSet> active = |
+ std::unique_ptr<const PermissionSet> active = |
params.active_permissions.ToPermissionSet(); |
- scoped_ptr<const PermissionSet> withheld = |
+ std::unique_ptr<const PermissionSet> withheld = |
params.withheld_permissions.ToPermissionSet(); |
UpdateOriginPermissions( |
@@ -1401,8 +1403,8 @@ void Dispatcher::RegisterBinding(const std::string& api_name, |
if (!source_map_.Contains(api_name)) { |
module_system->RegisterNativeHandler( |
api_name, |
- scoped_ptr<NativeHandler>(new BindingGeneratingNativeHandler( |
- context, api_name, "binding"))); |
+ std::unique_ptr<NativeHandler>( |
+ new BindingGeneratingNativeHandler(context, api_name, "binding"))); |
module_system->SetNativeLazyField( |
bind_object, bind_name, api_name, "binding"); |
} else { |
@@ -1427,14 +1429,11 @@ void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, |
BackgroundInfo::HasLazyBackgroundPage(extension)); |
module_system->RegisterNativeHandler( |
"process", |
- scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler( |
- context, |
- context->GetExtensionID(), |
+ std::unique_ptr<NativeHandler>(new ProcessInfoNativeHandler( |
+ context, context->GetExtensionID(), |
context->GetContextTypeDescription(), |
ExtensionsRendererClient::Get()->IsIncognitoProcess(), |
- is_component_extension, |
- manifest_version, |
- send_request_disabled))); |
+ is_component_extension, manifest_version, send_request_disabled))); |
delegate_->RegisterNativeHandlers(this, module_system, context); |
} |