1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_RENDERER_EXTENSIONS_ACTIVITY_LOG_CONVERTER_STRATEGY_H_ 6 #define CHROME_RENDERER_EXTENSIONS_ACTIVITY_LOG_CONVERTER_STRATEGY_H_ 7 8 #include "base/compiler_specific.h" 9 #include "content/public/renderer/v8_value_converter.h" 10 #include "v8/include/v8.h" 11 12 namespace extensions { 13 14 // This class is used by activity logger and extends behavior of 15 // V8ValueConverter. It overwrites conversion of V8 arrays and objects. When 16 // converting arrays and objects, we must not invoke any JS code which may 17 // result in triggering activity logger. In such case, the log entries will be 18 // generated due to V8 object conversion rather than extension activity. 19 class ActivityLogConverterStrategy 20 : public content::V8ValueConverter::Strategy { 21 public: 22 virtual ~ActivityLogConverterStrategy() {} 23 24 virtual bool FromV8Object(v8::Handle<v8::Object> value, 25 base::Value** out, 26 v8::Isolate* isolate) const OVERRIDE; 27 virtual bool FromV8Array(v8::Handle<v8::Array> value, 28 base::Value** out, 29 v8::Isolate* isolate) const OVERRIDE; 30 31 private: 32 bool FromV8ObjectInternal(v8::Handle<v8::Object> value, 33 base::Value** out, 34 v8::Isolate* isolate) const; 35 }; 36 37 } // namespace extensions 38 39 #endif // CHROME_RENDERER_EXTENSIONS_ACTIVITY_LOG_CONVERTER_STRATEGY_H_ 40