diff options
Diffstat (limited to 'ceee/ie/plugin/toolband/toolband.idl')
-rw-r--r-- | ceee/ie/plugin/toolband/toolband.idl | 370 |
1 files changed, 370 insertions, 0 deletions
diff --git a/ceee/ie/plugin/toolband/toolband.idl b/ceee/ie/plugin/toolband/toolband.idl new file mode 100644 index 0000000..4164945 --- /dev/null +++ b/ceee/ie/plugin/toolband/toolband.idl @@ -0,0 +1,370 @@ +// Copyright (c) 2010 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. +// +// @file +// Interface and object declarations for CEEE IE toolband. +import "oaidl.idl"; +import "ocidl.idl"; + +[ + object, + uuid(07995791-0923-4c4e-B861-AA3B933A31CC), + dual, + local, // no marshaling for this interface + nonextensible, + pointer_default(unique) +] +// Native interface to content scripts. This interface is exposed to +// ceee_boostrap.js, and is used to satisfy the same contract as +// Chrome's native functions declared in event_bindings.js and +// renderer_extension_bindings.js. Additionally this interface exposes +// properties for the dispatch functions declared in the same files. +// At any given time, this interface should to be synonymous with what you'd +// see by searching the two above files for the strings "dispatchOn" and +// "native function". +interface ICeeeContentScriptNativeApi : IDispatch { + // Supports JS console.log and console.error. + HRESULT Log([in] BSTR level, [in] BSTR message); + + // Port-related functions. + HRESULT OpenChannelToExtension([in] BSTR source_id, + [in] BSTR target_id, + [in] BSTR name, + [out, retval] long* port_id); + HRESULT CloseChannel([in] long port_id); + HRESULT PortAddRef([in] long port_id); + HRESULT PortRelease([in] long port_id); + HRESULT PostMessage([in] long port_id, [in] BSTR msg); + + // Event-related functions. + HRESULT AttachEvent([in] BSTR event_name); + HRESULT DetachEvent([in] BSTR event_name); + + // Event notification callbacks to script. + [propput] HRESULT onLoad(IDispatch* callback); + [propput] HRESULT onUnload(IDispatch* callback); + + // Port notification callbacks. + [propput] HRESULT onPortConnect(IDispatch* callback); + [propput] HRESULT onPortDisconnect(IDispatch* callback); + [propput] HRESULT onPortMessage(IDispatch* callback); +}; + +// An invalid tab Id. This is declared here so that both the BHO and the broker +// knows about it. +const int kInvalidChromeSessionId = -1; + +typedef long CeeeWindowHandle; + +typedef enum tagCeeeTabStatus { + kCeeeTabStatusLoading = 0, + kCeeeTabStatusComplete = 1, +} CeeeTabStatus; + +// Information about a tab. +typedef struct tagCeeeTabInfo { + BSTR url; + BSTR title; + CeeeTabStatus status; + BSTR fav_icon_url; +} CeeeTabInfo; + +typedef enum tagCeeeTabCodeType { + kCeeeTabCodeTypeCss = 0, + kCeeeTabCodeTypeJs = 1, +} CeeeTabCodeType; + +// Information about a window. +typedef struct { + BOOL focused; + RECT rect; + // We use a BSTR to dynamically allocate a list of couple (HWND, index). + // These are stored as a JSON list of longs, the even indexes are for ids + // and their associated odd numbers are the tab index. + // This value can be NULL if the caller didn't request to populate tabs. + BSTR tab_list; +} CeeeWindowInfo; + +// Information about an HTTP cookie. +typedef struct { + BSTR name; + BSTR value; + BSTR domain; + BOOL host_only; + BSTR path; + BOOL secure; + BOOL http_only; + BOOL session; + double expiration_date; + BSTR store_id; +} CeeeCookieInfo; + +[ + object, + uuid(8DEEECC5-7B49-482d-99F8-2109EA5F2618), + nonextensible, + helpstring("ICeeeWindowExecutor Interface"), + pointer_default(unique), + oleautomation +] +// Object provided to the broker to execute code in a given window's thread. +interface ICeeeWindowExecutor : IUnknown { + // Initializes the executor to work with the given CeeeWindowHandle. + // + // @param hwnd The HWND of the window the executor represents. + HRESULT Initialize([in] CeeeWindowHandle hwnd); + + // Returns information about the window represented by this executor. + // + // @param populate_tabs Specifies whether we want to receive the list of tabs. + // @param window_info Where to return the info about the window. The + // @p tab_list field are only set if @p populate_tabs is + // true. + HRESULT GetWindow([in] BOOL populate_tabs, + [out, ref] CeeeWindowInfo* window_info); + + // Returns the list of tabs of this window. We return both the tab HWND and + // the tab index (encoded in the @p tab_list BSTR) so that our callers don't + // need an extra IPC to get the tab index later on. + // + // @param tab_list Where to return the tab identifiers in the same format as + // described for tagCeeeWindowInfo::tab_ids. + HRESULT GetTabs([out, retval] BSTR* tab_list); + + // Updates the window with the given set of parameters. + // + // @param left The new left position of the window. -1 to leave unchanged. + // @param top The new top position of the window. -1 to leave unchanged. + // @param width The new width of the window. -1 to leave unchanged. + // @param height The new height of the window. -1 to leave unchanged. + // @param window_info Where to return the new info about the updated window. + HRESULT UpdateWindow( + [in] long left, [in] long top, [in] long width, [in] long height, + [out, ref] CeeeWindowInfo* window_info); + + // Close the window represented by our FrameExecutor. + // + // @retval S_OK We could successfully and silently removed the window. + // @retval S_FALSE We failed to <b>silently</b> remove the window, + // so the caller should try other alternatives (e.g., + // posting WM_CLOSE to the window). + HRESULT RemoveWindow(); + + // Returns the index of the given tab. + // + // @param tab The window handle (HWND) of the tab we want the index of. + // @param index Where to return the index. + HRESULT GetTabIndex([in] CeeeWindowHandle tab, [out, ref] long* index); + + // Moves the tab specified by @p tab to the index identified by @p index. + // + // @param tab The window handle (HWND) of the tab to move. + // @param index Where to move the tab. + HRESULT MoveTab([in] CeeeWindowHandle tab, [in] long index); + + // Removes the specified tab. + // + // @param tab The window handle (HWND) of the tab to be removed. + HRESULT RemoveTab([in] CeeeWindowHandle tab); + + // Selects the specified tab. + // + // @param tab The window handle (HWND) of the tab to be selected. + HRESULT SelectTab([in] CeeeWindowHandle tab); +}; + +[ + object, + uuid(C7FF41BA-72D5-4086-8B5A-2EF4FD12E0FE), + nonextensible, + helpstring("ICeeeTabExecutor Interface"), + pointer_default(unique), + oleautomation +] +// Object provided to the broker to execute code in a given window's thread. +interface ICeeeTabExecutor : IUnknown { + // Initializes the executor to work with the given CeeeWindowHandle. + // + // @param hwnd The HWND of the tab the executor represents. + HRESULT Initialize([in] CeeeWindowHandle hwnd); + + // Returns information about the tab represented by the TabExecutor in + // @p tab_info structure used to return the information. + // + // @param tab_info Where to return the tab information. + // + // @rvalue S_OK Success + // @return Other failure HRESULTs may also be returned in case of cascading + // errors. + HRESULT GetTabInfo([out, ref] CeeeTabInfo* tab_info); + + // Navigate to the given url from the given properties. + // + // @param url The URL where to navigate the tab to. Can NOT be NULL. + // @param flags Specifies the type of navigation based on the + // BrowserNavConstants enum values. + // @param target Specifies the navigation target (e.g., _top or _blank). + // + // @rvalue S_OK Success + // S_FALSE Nothing needed to be done since the URL was already set. + // @return Other failure HRESULTs may also be returned in case of cascading + // errors. + HRESULT Navigate([in] BSTR url, [in] long flags, [in] BSTR target); + + // Execute or insert code inside a tab. + // + // @param code The code to execute or insert. + // @param file A path to the file that contains the script to execute. + // This path is relative to the extension root. + // @param all_frames If true, applies to the top level frame as well as + // contained iframes. Otherwise, applies onlt to the + // top level frame. + HRESULT InsertCode([in] BSTR code, + [in] BSTR file, + [in] BOOL all_frames, + [in] CeeeTabCodeType type); +}; + +[ + object, + uuid(07630967-D7FB-4745-992F-28614930D9A3), + nonextensible, + helpstring("ICeeeCookieExecutor Interface"), + pointer_default(unique), + oleautomation +] +// Object provided to the broker to execute code in a given window's thread. +interface ICeeeCookieExecutor : IUnknown { + // Returns information about the cookie identified by the @c name field of + // the @p cookie_info structure used to return the information. + // + // @param url The URL with which the cookie to retrieve is associated. + // @param name The name of the cookie to retrieve. + // @param cookie_info Where to return the cookie information. + HRESULT GetCookie([in] BSTR url, [in] BSTR name, + [out, ref] CeeeCookieInfo* cookie_info); + + // Registers the executor's process as a known cookie store; used to indicate + // that the cookie store ID has been issued for this process and may be used + // in other cookie APIs. + // This API is used to ensure that stale cookie store IDs don't inadvertently + // match new cookie store processes. This may happen because IE derives the + // cookie store ID from the IE process ID, which may be recycled by Windows. + // The first time a cookie store ID is issued for an IE process, this + // RegisterCookieStore function should be called to indicate that the IE + // process may now be selected by a user-provided store ID. All cookie APIs + // should verify that CookieStoreIsRegistered() returns S_OK before matching + // a user-provided cookie store ID to an IE process. + HRESULT RegisterCookieStore(); + + // Returns S_OK if the executor's process has been registered as a cookie + // store, S_FALSE if not. All cookie API implementations must ensure this + // call returns S_OK before accessing a cookie store via a user-provided + // cookie store ID; if it doesn't, the store ID is stale. + HRESULT CookieStoreIsRegistered(); +}; + +[ + object, + uuid(276D47E8-1692-4a21-907D-948D170E4330), + nonextensible, + helpstring("ICeeeInfobarExecutor Interface"), + pointer_default(unique), + oleautomation +] +// Object provided to the broker to execute code in a given window's thread. +interface ICeeeInfobarExecutor : IUnknown { + // Stores the id of our extension. + // @param extension_id The id of the extension. + HRESULT SetExtensionId([in] BSTR extension_id); + + // Creates infobar and opens @p url in it. Translates relative path to the + // absolute path using "chrome-extension://extension_id" prefix where + // extension_id is the id set by SetExtensionId() call. + // @param url The URL the infobar window should be navigated to. + // @param window_handle Where to return the handle of the window in which + // this infobar was created. + HRESULT ShowInfobar([in] BSTR url, + [out, ref] CeeeWindowHandle* window_handle); + + // Notifies infobar about OnBeforeNavigate2 event for the browser top frame. + // @param url The URL the top frame is about to navigate to. + HRESULT OnTopFrameBeforeNavigate([in] BSTR url); +}; + +[ + object, + uuid(BBB10A7B-DB0D-4f1a-8669-65378DAD0C99), + nonextensible, + helpstring("ICeeeExecutorCreator Interface"), + pointer_default(unique), + local +] +// Creates an executor in a destination thread, and registers it in the +// CeeeBroker. + +// Used to instantiate a CeeeExecutor. +interface ICeeeExecutorCreator : IUnknown { + // Creates a CeeeExecutor for the given @p thread_id. + // + // @param thread_id The identifier of the destination thread where we want + // an executor to be creared. + // @param window The window handle (HWND) the new executor represents. + HRESULT CreateWindowExecutor([in] long thread_id, + [in] CeeeWindowHandle window); + + // Teardown what was left hanging while waiting for the + // new executor to be registered for the given @p thread_id. + // + // @param thread_id The identifier of the destination thread for which we want + // to tear down our infrastructure. + HRESULT Teardown([in] long thread_id); +}; + +[ + uuid(7C09079D-F9CB-4E9E-9293-D224B071D8BA), + version(1.0), + helpstring("Google CEEE 1.0 Type Library") +] +library ToolbandLib { + importlib("stdole2.tlb"); + + // include type info in .tlb + interface ICEEEContentScriptNativeApi; + interface ICeeeTabExecutor; + interface ICeeeWindowExecutor; + + [ + uuid(E49EBDB7-CEC9-4014-A5F5-8D3C8F5997DC), + helpstring("BrowserHelperObject Class") + ] + coclass BrowserHelperObject { + [default] interface IUnknown; + }; + [ + uuid(2F1A2D6B-55F6-4B63-8C37-F698D28FDC2B), + helpstring("ToolBand Class") + ] + coclass ToolBand { + [default] interface IUnknown; + }; + [ + uuid(4A562910-2D54-4e98-B87F-D4A7F5F5D0B9), + helpstring("CEEE Executor Creator Class") + ] + coclass CeeeExecutorCreator { + [default] interface IUnknown; + }; + [ + uuid(057FCFE3-F872-483d-86B0-0430E375E41F), + helpstring("CEEE Executor Class") + ] + coclass CeeeExecutor { + [default] interface IUnknown; + interface ICeeeTabExecutor; + interface ICeeeWindowExecutor; + interface ICeeeCookieExecutor; + interface ICeeeInfobarExecutor; + }; +}; |