OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |