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.
5 #ifndef CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_
6 #define CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_
10 #include "chrome/renderer/extensions/object_backed_native_handler.h"
12 namespace extensions {
14 // Exposes logging.h macros to JavaScript bindings.
15 class LoggingNativeHandler : public ObjectBackedNativeHandler {
17 explicit LoggingNativeHandler(ChromeV8Context* context);
18 virtual ~LoggingNativeHandler();
20 // Equivalent to CHECK(predicate) << message.
22 // void(predicate, message?)
23 void Check(const v8::FunctionCallbackInfo<v8::Value>& args);
25 // Equivalent to DCHECK(predicate) << message.
27 // void(predicate, message?)
28 void Dcheck(const v8::FunctionCallbackInfo<v8::Value>& args);
30 // Equivalent to DCHECK_IS_ON().
33 void DcheckIsOn(const v8::FunctionCallbackInfo<v8::Value>& args);
35 // Equivalent to LOG(INFO) << message.
38 void Log(const v8::FunctionCallbackInfo<v8::Value>& args);
40 // Equivalent to LOG(WARNING) << message.
43 void Warning(const v8::FunctionCallbackInfo<v8::Value>& args);
45 void ParseArgs(const v8::FunctionCallbackInfo<v8::Value>& args,
47 std::string* error_message);
49 std::string ToStringOrDefault(const v8::Handle<v8::String>& v8_string,
50 const std::string& dflt);
53 } // namespace extensions
55 #endif // CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_