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

Unified Diff: chrome/renderer/extensions/console.h

Issue 12853007: Don't throw exceptions when v8 objects/contexts are missing, and catch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test #2 Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/app_bindings.cc ('k') | chrome/renderer/extensions/console.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/console.h
diff --git a/chrome/renderer/extensions/console.h b/chrome/renderer/extensions/console.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4018cfe39adf5b7f53ff5c16834b6fb6189795a
--- /dev/null
+++ b/chrome/renderer/extensions/console.h
@@ -0,0 +1,46 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_EXTENSIONS_CONSOLE_H_
+#define CHROME_RENDERER_EXTENSIONS_CONSOLE_H_
+
+#include <string>
+
+#include "content/public/common/console_message_level.h"
+#include "v8/include/v8.h"
+
+namespace content {
+class RenderView;
+}
+
+namespace extensions {
+
+// Utility for logging messages to RenderViews.
+namespace console {
+
+// Adds |message| to the console of |render_view| at various log levels.
+void Debug(content::RenderView* render_view, const std::string& message);
+void Log(content::RenderView* render_view, const std::string& message);
+void Warn(content::RenderView* render_view, const std::string& message);
+void Error(content::RenderView* render_view, const std::string& message);
+
+void AddMessage(content::RenderView* render_view,
+ content::ConsoleMessageLevel level,
+ const std::string& message);
+
+// Adds |message| to the console that hosts |context|, if any.
+void Debug(v8::Handle<v8::Context> context, const std::string& message);
+void Log(v8::Handle<v8::Context> context, const std::string& message);
+void Warn(v8::Handle<v8::Context> context, const std::string& message);
+void Error(v8::Handle<v8::Context> context, const std::string& message);
+
+void AddMessage(v8::Handle<v8::Context> context,
+ content::ConsoleMessageLevel level,
+ const std::string& message);
+
+} // namespace console
+
+} // namespace extensions
+
+#endif // CHROME_RENDERER_EXTENSIONS_CONSOLE_H_
« no previous file with comments | « chrome/renderer/extensions/app_bindings.cc ('k') | chrome/renderer/extensions/console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698