15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * This file defines the <code>PPB_Console</code> interface.
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)[generate_thunk]
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)label Chrome {
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  M25 = 1.0
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)[assert_size(4)]
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)enum PP_LogLevel {
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_LOGLEVEL_TIP = 0,
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_LOGLEVEL_LOG = 1,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_LOGLEVEL_WARNING = 2,
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_LOGLEVEL_ERROR = 3
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)interface PPB_Console {
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Logs the given message to the JavaScript console associated with the
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * given plugin instance with the given logging level. The name of the plugin
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * issuing the log message will be automatically prepended to the message.
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * The value may be any type of Var.
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Log(
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      [in] PP_Instance instance,
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      [in] PP_LogLevel level,
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      [in] PP_Var value);
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /**
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * Logs a message to the console with the given source information rather
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * than using the internal PPAPI plugin name. The name must be a string var.
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   *
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * The regular log function will automatically prepend the name of your
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * plugin to the message as the "source" of the message. Some plugins may
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * wish to override this. For example, if your plugin is a Python
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * interpreter, you would want log messages to contain the source .py file
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   * doing the log statement rather than have "python" show up in the console.
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   */
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LogWithSource(
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      [in] PP_Instance instance,
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      [in] PP_LogLevel level,
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      [in] PP_Var source,
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      [in] PP_Var value);
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
52