blob: 2fd37a4207972f9f1aa75448dd7883a4b50123f3 [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// Copyright (c) 2006-2008 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.
initial.commit09911bf2008-07-26 23:55:294
5#ifndef CHROME_BROWSER_CHROME_PLUGIN_HOST_H__
6#define CHROME_BROWSER_CHROME_PLUGIN_HOST_H__
7
8#include "chrome/common/chrome_plugin_api.h"
9
10// Returns the table of browser functions for use from the browser process.
11CPBrowserFuncs* GetCPBrowserFuncsForBrowser();
12
13// Interface for generic data passed to plugin UI command handlers.
14// Note: All functions are called on the plugin thread.
15class CPCommandInterface {
16 public:
17 virtual ~CPCommandInterface() {}
18
19 // Returns the actual pointer to pass to the plugin.
20 virtual void *GetData() = 0;
21
22 // Called when the command has been invoked. The default action is deletion,
23 // but some callers may want to use output or check the return value before
24 // deleting.
25 virtual void OnCommandInvoked(CPError retval) {
26 delete this;
27 }
28
29 // Some commands have an asynchronous response. This is called some time
30 // after OnCommandInvoked.
31 virtual void OnCommandResponse(CPError retval) { }
32};
33
34// Called when a builtin or plugin-registered UI command is invoked by a user
35// gesture. 'data' is an optional parameter that allows command-specific data
36// to be passed to the plugin. Ownership of 'data' is transferred to the
37// callee. CPBrowsingContext is some additional data the caller wishes to pass
38// through to the receiver. OnCommandInvoked is called after the command has
39// been invoked.
40void CPHandleCommand(int command, CPCommandInterface* data,
41 CPBrowsingContext context);
42
43#endif // CHROME_BROWSER_CHROME_PLUGIN_HOST_H__