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

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

Issue 1433293004: [Extensions] Don't allow gin::Define to be overridden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/public/child/v8_value_converter.h" 8 #include "content/public/child/v8_value_converter.h"
9 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
10 #include "extensions/common/extension_messages.h" 10 #include "extensions/common/extension_messages.h"
(...skipping 20 matching lines...) Expand all
31 // static 31 // static
32 void APIActivityLogger::LogEvent( 32 void APIActivityLogger::LogEvent(
33 const v8::FunctionCallbackInfo<v8::Value>& args) { 33 const v8::FunctionCallbackInfo<v8::Value>& args) {
34 LogInternal(EVENT, args); 34 LogInternal(EVENT, args);
35 } 35 }
36 36
37 // static 37 // static
38 void APIActivityLogger::LogInternal( 38 void APIActivityLogger::LogInternal(
39 const CallType call_type, 39 const CallType call_type,
40 const v8::FunctionCallbackInfo<v8::Value>& args) { 40 const v8::FunctionCallbackInfo<v8::Value>& args) {
41 DCHECK_GT(args.Length(), 2); 41 CHECK_GT(args.Length(), 2);
42 DCHECK(args[0]->IsString()); 42 CHECK(args[0]->IsString());
43 DCHECK(args[1]->IsString()); 43 CHECK(args[1]->IsString());
44 DCHECK(args[2]->IsArray()); 44 CHECK(args[2]->IsArray());
45 45
46 std::string ext_id = *v8::String::Utf8Value(args[0]); 46 std::string ext_id = *v8::String::Utf8Value(args[0]);
47 ExtensionHostMsg_APIActionOrEvent_Params params; 47 ExtensionHostMsg_APIActionOrEvent_Params params;
48 params.api_call = *v8::String::Utf8Value(args[1]); 48 params.api_call = *v8::String::Utf8Value(args[1]);
49 if (args.Length() == 4) // Extras are optional. 49 if (args.Length() == 4) // Extras are optional.
50 params.extra = *v8::String::Utf8Value(args[3]); 50 params.extra = *v8::String::Utf8Value(args[3]);
51 else 51 else
52 params.extra = ""; 52 params.extra = "";
53 53
54 // Get the array of api call arguments. 54 // Get the array of api call arguments.
(...skipping 16 matching lines...) Expand all
71 if (call_type == APICALL) { 71 if (call_type == APICALL) {
72 content::RenderThread::Get()->Send( 72 content::RenderThread::Get()->Send(
73 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params)); 73 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params));
74 } else if (call_type == EVENT) { 74 } else if (call_type == EVENT) {
75 content::RenderThread::Get()->Send( 75 content::RenderThread::Get()->Send(
76 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params)); 76 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params));
77 } 77 }
78 } 78 }
79 79
80 } // namespace extensions 80 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/bindings/override_gin_define.html ('k') | extensions/renderer/blob_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698