Home | History | Annotate | Download | only in plugin
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_
      6 #define REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_
      7 
      8 #include <string>
      9 
     10 namespace remoting {
     11 
     12 class HostNPScriptObject;
     13 
     14 class HostLogHandler {
     15  public:
     16   // Register the log handler.
     17   // These should be called from the plugin init/destroy methods so that they
     18   // are only called once per plugin process (not once per plugin instance).
     19   static void RegisterLogMessageHandler();
     20 
     21   // We don't have the corresponding UnregisterLogMessageHandler because it
     22   // is not safe to call it when there are multiple threads that might be
     23   // logging.
     24 
     25   static void RegisterLoggingScriptObject(HostNPScriptObject* script_object);
     26   static void UnregisterLoggingScriptObject(HostNPScriptObject* script_object);
     27 
     28  private:
     29   // A Log Message Handler that is called after each LOG message has been
     30   // processed. This must be of type LogMessageHandlerFunction defined in
     31   // base/logging.h.
     32   static bool LogToUI(int severity, const char* file, int line,
     33                       size_t message_start, const std::string& str);
     34 };
     35 
     36 }  // namespace remoting
     37 
     38 #endif  // REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_
     39