| OLD | NEW |
| 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 |
| 6 #include "base/bind.h" | 7 #include "base/bind.h" |
| 7 #include "chrome/renderer/chrome_render_process_observer.h" | |
| 8 #include "chrome/renderer/extensions/activity_log_converter_strategy.h" | 8 #include "chrome/renderer/extensions/activity_log_converter_strategy.h" |
| 9 #include "chrome/renderer/extensions/api_activity_logger.h" | 9 #include "chrome/renderer/extensions/api_activity_logger.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| 11 #include "content/public/renderer/v8_value_converter.h" | 11 #include "content/public/renderer/v8_value_converter.h" |
| 12 #include "extensions/common/extension_messages.h" | 12 #include "extensions/common/extension_messages.h" |
| 13 #include "extensions/renderer/script_context.h" |
| 13 | 14 |
| 14 using content::V8ValueConverter; | 15 using content::V8ValueConverter; |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 APIActivityLogger::APIActivityLogger( | 19 APIActivityLogger::APIActivityLogger(ScriptContext* context) |
| 19 Dispatcher* dispatcher, ChromeV8Context* context) | 20 : ObjectBackedNativeHandler(context) { |
| 20 : ChromeV8Extension(dispatcher, context) { | |
| 21 RouteFunction("LogEvent", base::Bind(&APIActivityLogger::LogEvent)); | 21 RouteFunction("LogEvent", base::Bind(&APIActivityLogger::LogEvent)); |
| 22 RouteFunction("LogAPICall", base::Bind(&APIActivityLogger::LogAPICall)); | 22 RouteFunction("LogAPICall", base::Bind(&APIActivityLogger::LogAPICall)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 void APIActivityLogger::LogAPICall( | 26 void APIActivityLogger::LogAPICall( |
| 27 const v8::FunctionCallbackInfo<v8::Value>& args) { | 27 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 28 LogInternal(APICALL, args); | 28 LogInternal(APICALL, args); |
| 29 } | 29 } |
| 30 | 30 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (call_type == APICALL) { | 70 if (call_type == APICALL) { |
| 71 content::RenderThread::Get()->Send( | 71 content::RenderThread::Get()->Send( |
| 72 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params)); | 72 new ExtensionHostMsg_AddAPIActionToActivityLog(ext_id, params)); |
| 73 } else if (call_type == EVENT) { | 73 } else if (call_type == EVENT) { |
| 74 content::RenderThread::Get()->Send( | 74 content::RenderThread::Get()->Send( |
| 75 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params)); | 75 new ExtensionHostMsg_AddEventToActivityLog(ext_id, params)); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace extensions | 79 } // namespace extensions |
| OLD | NEW |