Index: remoting/host/plugin/host_log_handler.h |
diff --git a/remoting/host/plugin/host_log_handler.h b/remoting/host/plugin/host_log_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fbb70eff64bad0ffcef4302cffa8f7550d1277af |
--- /dev/null |
+++ b/remoting/host/plugin/host_log_handler.h |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2011 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 REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ |
+#define REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ |
+ |
+#include "base/string16.h" |
Wez
2011/08/31 01:30:16
I don't think we need string16 here?
garykac
2011/08/31 23:59:46
Done.
|
+#include "base/threading/platform_thread.h" |
Wez
2011/08/31 01:30:16
I don't think we need platform threads here?
garykac
2011/08/31 23:59:46
Done.
|
+ |
+namespace remoting { |
+ |
+class HostNPScriptObject; |
+ |
+class HostLogHandler { |
+ public: |
+ // Register/Unregister the log handler. |
Wez
2011/08/31 01:30:16
nit: Lose /"Unregister".
garykac
2011/08/31 23:59:46
Done.
|
+ // These should be called from the plugin init/destroy methods so that they |
+ // are only called once per plugin process (not once per plugin instance). |
+ static void RegisterLogMessageHandler(); |
+ |
+ // We don't have the corresponding UnregisterLogMessageHandler because it |
+ // is not safe to call it when there are multiple threads that might be |
+ // logging. |
+ |
+ static void RegisterLoggingScriptObject(HostNPScriptObject* script_object); |
+ static void UnregisterLoggingScriptObject(HostNPScriptObject* script_object); |
+ |
+ private: |
+ // A Log Message Handler that is called after each LOG message has been |
+ // processed. This must be of type LogMessageHandlerFunction defined in |
+ // base/logging.h. |
+ static bool LogToUI(int severity, const char* file, int line, |
+ size_t message_start, const std::string& str); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ |