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

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

Issue 19730002: V8ValueConverter for the activity logger that does not invoke interceptors and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ben's comments Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "chrome/common/extensions/extension_messages.h" 7 #include "chrome/common/extensions/extension_messages.h"
8 #include "chrome/renderer/chrome_render_process_observer.h" 8 #include "chrome/renderer/chrome_render_process_observer.h"
9 #include "chrome/renderer/extensions/activity_log_converter_strategy.h"
9 #include "chrome/renderer/extensions/api_activity_logger.h" 10 #include "chrome/renderer/extensions/api_activity_logger.h"
10 #include "content/public/renderer/render_thread.h" 11 #include "content/public/renderer/render_thread.h"
11 #include "content/public/renderer/v8_value_converter.h" 12 #include "content/public/renderer/v8_value_converter.h"
12 13
13 using content::V8ValueConverter; 14 using content::V8ValueConverter;
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 APIActivityLogger::APIActivityLogger( 18 APIActivityLogger::APIActivityLogger(
18 Dispatcher* dispatcher, ChromeV8Context* context) 19 Dispatcher* dispatcher, ChromeV8Context* context)
(...skipping 30 matching lines...) Expand all
49 params.api_call = *v8::String::AsciiValue(args[1]); 50 params.api_call = *v8::String::AsciiValue(args[1]);
50 if (args.Length() == 4) // Extras are optional. 51 if (args.Length() == 4) // Extras are optional.
51 params.extra = *v8::String::AsciiValue(args[3]); 52 params.extra = *v8::String::AsciiValue(args[3]);
52 else 53 else
53 params.extra = ""; 54 params.extra = "";
54 55
55 // Get the array of api call arguments. 56 // Get the array of api call arguments.
56 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]);
57 if (arg_array->Length() > 0) { 58 if (arg_array->Length() > 0) {
58 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 59 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
60 ActivityLogConverterStrategy strategy;
61 converter->SetFunctionAllowed(true);
62 converter->SetStrategy(&strategy);
59 scoped_ptr<ListValue> arg_list(new ListValue()); 63 scoped_ptr<ListValue> arg_list(new ListValue());
60 for (size_t i = 0; i < arg_array->Length(); ++i) { 64 for (size_t i = 0; i < arg_array->Length(); ++i) {
61 arg_list->Set(i, 65 arg_list->Set(i,
62 converter->FromV8Value(arg_array->Get(i), 66 converter->FromV8Value(arg_array->Get(i),
63 v8::Context::GetCurrent())); 67 v8::Context::GetCurrent()));
64 } 68 }
65 params.arguments.Swap(arg_list.get()); 69 params.arguments.Swap(arg_list.get());
66 } 70 }
67 71
68 if (call_type == APICALL) { 72 if (call_type == APICALL) {
(...skipping 30 matching lines...) Expand all
99 result == Feature::INVALID_MAX_MANIFEST_VERSION || 103 result == Feature::INVALID_MAX_MANIFEST_VERSION ||
100 result == Feature::UNSUPPORTED_CHANNEL) 104 result == Feature::UNSUPPORTED_CHANNEL)
101 return; 105 return;
102 content::RenderThread::Get()->Send( 106 content::RenderThread::Get()->Send(
103 new ExtensionHostMsg_AddBlockedCallToActivityLog(extension_id, 107 new ExtensionHostMsg_AddBlockedCallToActivityLog(extension_id,
104 function_name)); 108 function_name));
105 } 109 }
106 110
107 111
108 } // namespace extensions 112 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698