| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/renderer/extensions/object_backed_native_handler.h" | 10 #include "chrome/renderer/extensions/object_backed_native_handler.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 // Exposes logging.h macros to JavaScript bindings. | 14 // Exposes logging.h macros to JavaScript bindings. |
| 15 class LoggingNativeHandler : public ObjectBackedNativeHandler { | 15 class LoggingNativeHandler : public ObjectBackedNativeHandler { |
| 16 public: | 16 public: |
| 17 explicit LoggingNativeHandler(ChromeV8Context* context); | 17 explicit LoggingNativeHandler(ChromeV8Context* context); |
| 18 virtual ~LoggingNativeHandler(); | 18 virtual ~LoggingNativeHandler(); |
| 19 | 19 |
| 20 // Equivalent to CHECK(predicate) << message. | 20 // Equivalent to CHECK(predicate) << message. |
| 21 // | 21 // |
| 22 // void(predicate, message?) | 22 // void(predicate, message?) |
| 23 void Check(const v8::FunctionCallbackInfo<v8::Value>& args); | 23 void Check(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 24 | 24 |
| 25 // Equivalent to DCHECK(predicate) << message. | 25 // Equivalent to DCHECK(predicate) << message. |
| 26 // | 26 // |
| 27 // void(predicate, message?) | 27 // void(predicate, message?) |
| 28 void Dcheck(const v8::FunctionCallbackInfo<v8::Value>& args); | 28 void Dcheck(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 29 | 29 |
| 30 // Equivalent to DCHECK_IS_ON(). | 30 // Equivalent to DCHECK_IS_ON. |
| 31 // | 31 // |
| 32 // bool() | 32 // bool() |
| 33 void DcheckIsOn(const v8::FunctionCallbackInfo<v8::Value>& args); | 33 void DcheckIsOn(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 34 | 34 |
| 35 // Equivalent to LOG(INFO) << message. | 35 // Equivalent to LOG(INFO) << message. |
| 36 // | 36 // |
| 37 // void(message) | 37 // void(message) |
| 38 void Log(const v8::FunctionCallbackInfo<v8::Value>& args); | 38 void Log(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 39 | 39 |
| 40 // Equivalent to LOG(WARNING) << message. | 40 // Equivalent to LOG(WARNING) << message. |
| 41 // | 41 // |
| 42 // void(message) | 42 // void(message) |
| 43 void Warning(const v8::FunctionCallbackInfo<v8::Value>& args); | 43 void Warning(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 44 | 44 |
| 45 void ParseArgs(const v8::FunctionCallbackInfo<v8::Value>& args, | 45 void ParseArgs(const v8::FunctionCallbackInfo<v8::Value>& args, |
| 46 bool* check_value, | 46 bool* check_value, |
| 47 std::string* error_message); | 47 std::string* error_message); |
| 48 | 48 |
| 49 std::string ToStringOrDefault(const v8::Handle<v8::String>& v8_string, | 49 std::string ToStringOrDefault(const v8::Handle<v8::String>& v8_string, |
| 50 const std::string& dflt); | 50 const std::string& dflt); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace extensions | 53 } // namespace extensions |
| 54 | 54 |
| 55 #endif // CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ | 55 #endif // CHROME_RENDERER_EXTENSIONS_LOGGING_NATIVE_HANDLER_H_ |
| OLD | NEW |