| 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/console.h" | 5 #include "chrome/renderer/extensions/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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 content::RenderView* render_view = ByContextFinder::Find(context); | 166 content::RenderView* render_view = ByContextFinder::Find(context); |
| 167 if (!render_view) { | 167 if (!render_view) { |
| 168 LOG(WARNING) << "Could not log \"" << message << "\": no render view found"; | 168 LOG(WARNING) << "Could not log \"" << message << "\": no render view found"; |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 AddMessage(render_view, level, message); | 171 AddMessage(render_view, level, message); |
| 172 } | 172 } |
| 173 | 173 |
| 174 v8::Local<v8::Object> AsV8Object() { | 174 v8::Local<v8::Object> AsV8Object() { |
| 175 v8::HandleScope handle_scope; | 175 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 176 v8::Local<v8::Object> console_object = v8::Object::New(); | 176 v8::Local<v8::Object> console_object = v8::Object::New(); |
| 177 BindLogMethod(console_object, "debug", &Debug); | 177 BindLogMethod(console_object, "debug", &Debug); |
| 178 BindLogMethod(console_object, "log", &Log); | 178 BindLogMethod(console_object, "log", &Log); |
| 179 BindLogMethod(console_object, "warn", &Warn); | 179 BindLogMethod(console_object, "warn", &Warn); |
| 180 BindLogMethod(console_object, "error", &Error); | 180 BindLogMethod(console_object, "error", &Error); |
| 181 return handle_scope.Close(console_object); | 181 return handle_scope.Close(console_object); |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace console | 184 } // namespace console |
| 185 } // namespace extensions | 185 } // namespace extensions |
| OLD | NEW |