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

Side by Side Diff: extensions/renderer/api_activity_logger.cc

Issue 1899083003: Convert //extensions/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "content/public/child/v8_value_converter.h" 10 #include "content/public/child/v8_value_converter.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ExtensionHostMsg_APIActionOrEvent_Params params; 49 ExtensionHostMsg_APIActionOrEvent_Params params;
50 params.api_call = *v8::String::Utf8Value(args[1]); 50 params.api_call = *v8::String::Utf8Value(args[1]);
51 if (args.Length() == 4) // Extras are optional. 51 if (args.Length() == 4) // Extras are optional.
52 params.extra = *v8::String::Utf8Value(args[3]); 52 params.extra = *v8::String::Utf8Value(args[3]);
53 else 53 else
54 params.extra = ""; 54 params.extra = "";
55 55
56 // Get the array of api call arguments. 56 // Get the array of api call arguments.
57 v8::Local<v8::Array> arg_array = v8::Local<v8::Array>::Cast(args[2]); 57 v8::Local<v8::Array> arg_array = v8::Local<v8::Array>::Cast(args[2]);
58 if (arg_array->Length() > 0) { 58 if (arg_array->Length() > 0) {
59 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 59 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create());
60 ActivityLogConverterStrategy strategy; 60 ActivityLogConverterStrategy strategy;
61 converter->SetFunctionAllowed(true); 61 converter->SetFunctionAllowed(true);
62 converter->SetStrategy(&strategy); 62 converter->SetStrategy(&strategy);
63 scoped_ptr<base::ListValue> arg_list(new base::ListValue()); 63 std::unique_ptr<base::ListValue> arg_list(new base::ListValue());
64 for (size_t i = 0; i < arg_array->Length(); ++i) { 64 for (size_t i = 0; i < arg_array->Length(); ++i) {
65 arg_list->Set( 65 arg_list->Set(
66 i, 66 i,
67 converter->FromV8Value(arg_array->Get(i), 67 converter->FromV8Value(arg_array->Get(i),
68 args.GetIsolate()->GetCurrentContext())); 68 args.GetIsolate()->GetCurrentContext()));
69 } 69 }
70 params.arguments.Swap(arg_list.get()); 70 params.arguments.Swap(arg_list.get());
71 } 71 }
72 72
73 if (call_type == APICALL) { 73 if (call_type == APICALL) {
74 content::RenderThread::Get()->Send( 74 content::RenderThread::Get()->Send(
75 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params)); 75 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params));
76 } else if (call_type == EVENT) { 76 } else if (call_type == EVENT) {
77 content::RenderThread::Get()->Send( 77 content::RenderThread::Get()->Send(
78 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params)); 78 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params));
79 } 79 }
80 } 80 }
81 81
82 } // namespace extensions 82 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api/serial/serial_api_unittest.cc ('k') | extensions/renderer/api_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698