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) const OVERRIDE; 26 virtual bool FromV8Array(v8::Handle<v8::Array> value, 27 base::Value** out) const OVERRIDE; 28 29 private: 30 bool FromV8ObjectInternal(v8::Handle<v8::Object> value, 31 base::Value** out) const; 32 }; 33 34 } // namespace extensions 35 36 #endif // CHROME_RENDERER_EXTENSIONS_ACTIVITY_LOG_CONVERTER_STRATEGY_H_ 37