| 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 #include "chrome/renderer/extensions/logging_native_handler.h" | 5 #include "chrome/renderer/extensions/logging_native_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| 11 | 11 |
| 12 LoggingNativeHandler::LoggingNativeHandler(ChromeV8Context* context) | 12 LoggingNativeHandler::LoggingNativeHandler(ScriptContext* context) |
| 13 : ObjectBackedNativeHandler(context) { | 13 : ObjectBackedNativeHandler(context) { |
| 14 RouteFunction("DCHECK", | 14 RouteFunction("DCHECK", |
| 15 base::Bind(&LoggingNativeHandler::Dcheck, base::Unretained(this))); | 15 base::Bind(&LoggingNativeHandler::Dcheck, base::Unretained(this))); |
| 16 RouteFunction("CHECK", | 16 RouteFunction("CHECK", |
| 17 base::Bind(&LoggingNativeHandler::Check, base::Unretained(this))); | 17 base::Bind(&LoggingNativeHandler::Check, base::Unretained(this))); |
| 18 RouteFunction("DCHECK_IS_ON", | 18 RouteFunction("DCHECK_IS_ON", |
| 19 base::Bind(&LoggingNativeHandler::DcheckIsOn, base::Unretained(this))); | 19 base::Bind(&LoggingNativeHandler::DcheckIsOn, base::Unretained(this))); |
| 20 RouteFunction("LOG", | 20 RouteFunction("LOG", |
| 21 base::Bind(&LoggingNativeHandler::Log, base::Unretained(this))); | 21 base::Bind(&LoggingNativeHandler::Log, base::Unretained(this))); |
| 22 RouteFunction("WARNING", | 22 RouteFunction("WARNING", |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 std::string LoggingNativeHandler::ToStringOrDefault( | 89 std::string LoggingNativeHandler::ToStringOrDefault( |
| 90 const v8::Handle<v8::String>& v8_string, | 90 const v8::Handle<v8::String>& v8_string, |
| 91 const std::string& dflt) { | 91 const std::string& dflt) { |
| 92 if (v8_string.IsEmpty()) | 92 if (v8_string.IsEmpty()) |
| 93 return dflt; | 93 return dflt; |
| 94 std::string ascii_value = *v8::String::Utf8Value(v8_string); | 94 std::string ascii_value = *v8::String::Utf8Value(v8_string); |
| 95 return ascii_value.empty() ? dflt : ascii_value; | 95 return ascii_value.empty() ? dflt : ascii_value; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace extensions | 98 } // namespace extensions |
| OLD | NEW |