| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/console.h" | 5 #include "extensions/renderer/console.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (!SetProperty(isolate->GetCurrentContext(), target, v8_name, function)) { | 83 if (!SetProperty(isolate->GetCurrentContext(), target, v8_name, function)) { |
| 84 LOG(WARNING) << "Could not bind log method \"" << name << "\""; | 84 LOG(WARNING) << "Could not bind log method \"" << name << "\""; |
| 85 } | 85 } |
| 86 SetProperty(isolate->GetCurrentContext(), target, v8_name, | 86 SetProperty(isolate->GetCurrentContext(), target, v8_name, |
| 87 tmpl->GetFunction()); | 87 tmpl->GetFunction()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 void Debug(content::RenderFrame* render_frame, const std::string& message) { | 92 void Debug(content::RenderFrame* render_frame, const std::string& message) { |
| 93 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_DEBUG, message); | 93 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_VERBOSE, message); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void Log(content::RenderFrame* render_frame, const std::string& message) { | 96 void Log(content::RenderFrame* render_frame, const std::string& message) { |
| 97 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_LOG, message); | 97 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_INFO, message); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void Warn(content::RenderFrame* render_frame, const std::string& message) { | 100 void Warn(content::RenderFrame* render_frame, const std::string& message) { |
| 101 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_WARNING, message); | 101 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_WARNING, message); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void Error(content::RenderFrame* render_frame, const std::string& message) { | 104 void Error(content::RenderFrame* render_frame, const std::string& message) { |
| 105 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_ERROR, message); | 105 AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_ERROR, message); |
| 106 } | 106 } |
| 107 | 107 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 126 v8::Local<v8::Object> console_object = v8::Object::New(isolate); | 126 v8::Local<v8::Object> console_object = v8::Object::New(isolate); |
| 127 BindLogMethod(isolate, console_object, "debug", &Debug); | 127 BindLogMethod(isolate, console_object, "debug", &Debug); |
| 128 BindLogMethod(isolate, console_object, "log", &Log); | 128 BindLogMethod(isolate, console_object, "log", &Log); |
| 129 BindLogMethod(isolate, console_object, "warn", &Warn); | 129 BindLogMethod(isolate, console_object, "warn", &Warn); |
| 130 BindLogMethod(isolate, console_object, "error", &Error); | 130 BindLogMethod(isolate, console_object, "error", &Error); |
| 131 return handle_scope.Escape(console_object); | 131 return handle_scope.Escape(console_object); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace console | 134 } // namespace console |
| 135 } // namespace extensions | 135 } // namespace extensions |
| OLD | NEW |