Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: extensions/renderer/console.h

Issue 2819683002: [Extenisons Bindings] Don't throw unchecked errors; add console errors (Closed)
Patch Set: jbroman's Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/api_request_handler_unittest.cc ('k') | extensions/renderer/console.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef EXTENSIONS_RENDERER_CONSOLE_H_ 5 #ifndef EXTENSIONS_RENDERER_CONSOLE_H_
6 #define EXTENSIONS_RENDERER_CONSOLE_H_ 6 #define EXTENSIONS_RENDERER_CONSOLE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/public/common/console_message_level.h" 10 #include "content/public/common/console_message_level.h"
11 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
12 12
13 namespace content { 13 namespace extensions {
14 class RenderFrame; 14 class ScriptContext;
15 }
16 15
17 namespace extensions { 16 // Utility for logging console messages.
18
19 // Utility for logging messages to RenderFrames.
20 namespace console { 17 namespace console {
21 18
22 // Adds |message| to the console of |render_frame|. If |render_frame| is null, 19 // Adds |message| to the console of of the |script_context|. If |script_context|
23 // LOG()s the message instead. 20 // is null, LOG()s the message instead.
24 void AddMessage(content::RenderFrame* render_frame, 21 void AddMessage(ScriptContext* script_context,
25 content::ConsoleMessageLevel level, 22 content::ConsoleMessageLevel level,
26 const std::string& message); 23 const std::string& message);
27 24
28 // Logs an Error then crashes the current process. 25 // Logs an Error then crashes the current process.
29 void Fatal(content::RenderFrame* render_frame, const std::string& message); 26 void Fatal(ScriptContext* context, const std::string& message);
30 27
31 // Returns a new v8::Object with each standard log method (Debug/Log/Warn/Error) 28 // Returns a new v8::Object with each standard log method (Debug/Log/Warn/Error)
32 // bound to respective debug/log/warn/error methods. This is a direct drop-in 29 // bound to respective debug/log/warn/error methods. This is a direct drop-in
33 // replacement for the standard devtools console.* methods usually accessible 30 // replacement for the standard devtools console.* methods usually accessible
34 // from JS. 31 // from JS.
35 v8::Local<v8::Object> AsV8Object(v8::Isolate* isolate); 32 v8::Local<v8::Object> AsV8Object(v8::Isolate* isolate);
36 33
37 } // namespace console 34 } // namespace console
38 35
39 } // namespace extensions 36 } // namespace extensions
40 37
41 #endif // EXTENSIONS_RENDERER_CONSOLE_H_ 38 #endif // EXTENSIONS_RENDERER_CONSOLE_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api_request_handler_unittest.cc ('k') | extensions/renderer/console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698