OLD | NEW |
| (Empty) |
1 // 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. | |
4 // | |
5 // This header specifies extensions to the Chrome Plugin API to support Gears. | |
6 | |
7 #ifndef CHROME_COMMON_GEARS_API_H__ | |
8 #define CHROME_COMMON_GEARS_API_H__ | |
9 #pragma once | |
10 | |
11 #include "chrome/common/chrome_plugin_api.h" | |
12 | |
13 #ifdef __cplusplus | |
14 extern "C" { | |
15 #endif | |
16 | |
17 // CommandIDs used when Chrome calls into Gears using CPP_HandleCommand. | |
18 // Note: do not change the enum values. We want to preserve backwards | |
19 // compatibility. | |
20 typedef enum { | |
21 // Ask gears to show its settings dialog. Typical usage is for the plugin | |
22 // to display it using a call to CPB_ShowHtmlDialog. No command_data is | |
23 // provided. | |
24 GEARSPLUGINCOMMAND_SHOW_SETTINGS = 0, | |
25 | |
26 // Ask gears to create a shortcut to a web page. command_data points | |
27 // to a GearsShortcutData struct. | |
28 GEARSPLUGINCOMMAND_CREATE_SHORTCUT = 1, | |
29 | |
30 // Query gears for the list of installed shortcuts. command_data points | |
31 // to a GearsShortcutList struct. | |
32 GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST = 2, | |
33 } GearsPluginCommand; | |
34 | |
35 // CommandIDs used when Gears calls into Chrome using CPB_HandleCommand. | |
36 // Note: do not change the enum values. We want to preserve backwards | |
37 // compatibility. | |
38 typedef enum { | |
39 // Tell chrome that the GEARSPLUGINCOMMAND_CREATE_SHORTCUT command is done, | |
40 // and the user has closed the dialog. command_data points to the same | |
41 // GearsShortcutData struct that was passed to the plugin command. | |
42 GEARSBROWSERCOMMAND_CREATE_SHORTCUT_DONE = 1, | |
43 | |
44 // Notifies the browser of changes to the gears shortcuts database. | |
45 // command_data is null. | |
46 GEARSBROWSERCOMMAND_NOTIFY_SHORTCUTS_CHANGED = 3, | |
47 } GearsBrowserCommand; | |
48 | |
49 // Note: currently only 16x16, 32x32, 48x48, and 128x128 icons are supported. | |
50 typedef struct _GearsShortcutIcon { | |
51 const char* size; // unused | |
52 const char* url; // the URL of the icon, which should be a PNG image | |
53 int width; // width of the icon | |
54 int height; // height of the icon | |
55 } GearsShortcutIcon; | |
56 | |
57 // Command data for GEARSPLUGINCOMMAND_CREATE_SHORTCUT. | |
58 typedef struct _GearsShortcutData { | |
59 const char* name; // the shortcut's name (also used as the filename) | |
60 const char* url; // the URL that the shortcut should launch | |
61 const char* description; // an optional description | |
62 GearsShortcutIcon icons[4]; // list of icons to use for this shortcut | |
63 } GearsShortcutData; | |
64 | |
65 // Command data for GEARSPLUGINCOMMAND_CREATE_SHORTCUT used in 0.6 and later. | |
66 // This struct is backwards compatible with the first version. | |
67 // http://b/viewIssue?id=1331408 - Chrome sanitizes 'name' for compatibility | |
68 // with older versions of Gears that expect this. 'orig_name' is unsanitized, | |
69 // which allows Gears to do its own validation. | |
70 typedef struct _GearsShortcutData2 { | |
71 const char* name; // unused - for back compat with above struct | |
72 const char* url; // the URL that the shortcut should launch | |
73 const char* description; // an optional description | |
74 GearsShortcutIcon icons[4]; // list of icons to use for this shortcut | |
75 const char* orig_name; // the shortcut's unmodified filename (added in 0.6) | |
76 } GearsShortcutData2; | |
77 | |
78 // Command data for GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST. | |
79 typedef struct _GearsShortcutList { | |
80 // Note: these are output params, set by Gears. There are no input params. | |
81 // Memory for these shortcuts, including the strings they hold, should be | |
82 // freed by the browser using CPB_Free. | |
83 GearsShortcutData* shortcuts; // array of installed shortcuts | |
84 uint32 num_shortcuts; // size of the array | |
85 } GearsShortcutList; | |
86 | |
87 // Command data for GEARSBROWSERCOMMAND_CREATE_SHORTCUT_DONE | |
88 typedef struct _GearsCreateShortcutResult { | |
89 GearsShortcutData2* shortcut; // pointer to struct passed to | |
90 // GEARSPLUGINCOMMAND_CREATE_SHORTCUT | |
91 CPError result; // CPERR_SUCCESS if shortcut was created, or error otherwise | |
92 } GearsCreateShortcutResult; | |
93 | |
94 #ifdef __cplusplus | |
95 } // extern "C" | |
96 #endif | |
97 | |
98 #endif // CHROME_COMMON_GEARS_API_H_ | |
OLD | NEW |