blob: 499170cae7eb69da2c932c374172cb17d97caa8b [file] [log] [blame]
[email protected]701a94e2014-04-17 04:37:371// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]f8d87d32013-06-06 02:51:292// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]701a94e2014-04-17 04:37:375#ifndef EXTENSIONS_RENDERER_LOGGING_NATIVE_HANDLER_H_
6#define EXTENSIONS_RENDERER_LOGGING_NATIVE_HANDLER_H_
[email protected]f8d87d32013-06-06 02:51:297
8#include <string>
9
[email protected]f55c90ee62014-04-12 00:50:0310#include "extensions/renderer/object_backed_native_handler.h"
[email protected]f8d87d32013-06-06 02:51:2911
12namespace extensions {
[email protected]f55c90ee62014-04-12 00:50:0313class ScriptContext;
[email protected]f8d87d32013-06-06 02:51:2914
15// Exposes logging.h macros to JavaScript bindings.
16class LoggingNativeHandler : public ObjectBackedNativeHandler {
17 public:
[email protected]f55c90ee62014-04-12 00:50:0318 explicit LoggingNativeHandler(ScriptContext* context);
dcheng9168b2f2014-10-21 12:38:2419 ~LoggingNativeHandler() override;
[email protected]f8d87d32013-06-06 02:51:2920
Devlin Cronind9ea8342018-01-27 06:00:0421 // ObjectBackedNativeHandler:
22 void AddRoutes() override;
23
[email protected]f8d87d32013-06-06 02:51:2924 // Equivalent to CHECK(predicate) << message.
25 //
26 // void(predicate, message?)
[email protected]d8c5fbb2013-06-14 11:35:2527 void Check(const v8::FunctionCallbackInfo<v8::Value>& args);
[email protected]f8d87d32013-06-06 02:51:2928
29 // Equivalent to DCHECK(predicate) << message.
30 //
31 // void(predicate, message?)
[email protected]d8c5fbb2013-06-14 11:35:2532 void Dcheck(const v8::FunctionCallbackInfo<v8::Value>& args);
[email protected]f8d87d32013-06-06 02:51:2933
danakje649f572015-01-08 23:35:5834 // Equivalent to DCHECK_IS_ON().
[email protected]f8d87d32013-06-06 02:51:2935 //
36 // bool()
[email protected]d8c5fbb2013-06-14 11:35:2537 void DcheckIsOn(const v8::FunctionCallbackInfo<v8::Value>& args);
[email protected]f8d87d32013-06-06 02:51:2938
39 // Equivalent to LOG(INFO) << message.
40 //
41 // void(message)
[email protected]d8c5fbb2013-06-14 11:35:2542 void Log(const v8::FunctionCallbackInfo<v8::Value>& args);
[email protected]f8d87d32013-06-06 02:51:2943
44 // Equivalent to LOG(WARNING) << message.
45 //
46 // void(message)
[email protected]d8c5fbb2013-06-14 11:35:2547 void Warning(const v8::FunctionCallbackInfo<v8::Value>& args);
[email protected]f8d87d32013-06-06 02:51:2948
[email protected]d8c5fbb2013-06-14 11:35:2549 void ParseArgs(const v8::FunctionCallbackInfo<v8::Value>& args,
[email protected]f8d87d32013-06-06 02:51:2950 bool* check_value,
51 std::string* error_message);
[email protected]f8d87d32013-06-06 02:51:2952};
53
54} // namespace extensions
55
[email protected]701a94e2014-04-17 04:37:3756#endif // EXTENSIONS_RENDERER_LOGGING_NATIVE_HANDLER_H_