Home | History | Annotate | Download | only in chrome_frame
      1 // Copyright (c) 2009 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 file will be processed by the MIDL tool to
      6 // produce the type library (chrome_tab.tlb) and marshalling code.
      7 
      8 #include "olectl.h"
      9 import "oaidl.idl";
     10 import "ocidl.idl";
     11 
     12 [
     13   object,
     14   uuid(FB243E4B-8AC2-4840-95F2-91B9AF9CFF10),
     15   dual,
     16   nonextensible,
     17   helpstring("IChromeFrame Interface"),
     18   pointer_default(unique)
     19 ]
     20 interface IChromeFrame : IDispatch {
     21   [propget, id(1)]
     22   HRESULT src([out, retval] BSTR* src);
     23   [propput, id(1)]
     24   HRESULT src([in] BSTR src);
     25 
     26   [id(3)]
     27   HRESULT postMessage([in] BSTR message, [in, optional] VARIANT target);
     28 
     29   [id(4), propget]
     30   HRESULT onload([out, retval] VARIANT* onload_handler);
     31   [id(4), propput]
     32   HRESULT onload([in] VARIANT onload_handler);
     33 
     34   [propget, id(5)]
     35   HRESULT onloaderror([out, retval] VARIANT* onerror_handler);
     36   [propput, id(5)]
     37   HRESULT onloaderror([in] VARIANT onerror_handler);
     38 
     39   [propget, id(6)]
     40   HRESULT onmessage([out, retval] VARIANT* onmessage_handler);
     41   [propput, id(6)]
     42   HRESULT onmessage([in] VARIANT onmessage_handler);
     43 
     44   [propget, id(DISPID_READYSTATE)]
     45   HRESULT readyState([out, retval] long* ready_state);
     46 
     47   [id(7)]
     48   HRESULT addEventListener([in] BSTR event_type, [in] IDispatch* listener,
     49                            [in, optional] VARIANT use_capture);
     50 
     51   [id(8)]
     52   HRESULT removeEventListener([in] BSTR event_type, [in] IDispatch* listener,
     53                               [in, optional] VARIANT use_capture);
     54 
     55   [propget, id(9)]
     56   HRESULT version([out, retval] BSTR* version);
     57 
     58   [id(10), hidden]
     59   // This method is available only when the control is in privileged mode.
     60   HRESULT postPrivateMessage([in] BSTR message,
     61                              [in] BSTR origin,
     62                              [in] BSTR target);
     63 
     64   [propget, id(11)]
     65   HRESULT useChromeNetwork([out, retval] VARIANT_BOOL* pVal);
     66   [propput, id(11)]
     67   HRESULT useChromeNetwork([in] VARIANT_BOOL newVal);
     68 
     69   [id(12), hidden]
     70   // Deprecated. Returns E_NOTIMPL.
     71   HRESULT installExtension([in] BSTR crx_path);
     72 
     73   [id(13), hidden]
     74   // Deprecated. Returns E_NOTIMPL.
     75   HRESULT loadExtension([in] BSTR extension_path);
     76 
     77   [id(14), hidden]
     78   // Deprecated. Returns E_NOTIMPL.
     79   HRESULT getEnabledExtensions();
     80 
     81   [id(15)]
     82   // This method bootstraps the BHO if it is not already loaded.
     83   HRESULT registerBhoIfNeeded();
     84 };
     85 
     86 [
     87   object,
     88   uuid(E98FDFD9-312B-444a-A640-8E88F3CC08B8),
     89   oleautomation,
     90   nonextensible,
     91   hidden
     92 ]
     93 // Internal implementation interface. Not intended as an API. May change
     94 // frequently, don't treat this as frozen.
     95 interface IChromeFramePrivileged : IUnknown {
     96   // If the host returns false for wants_privileged, the control
     97   // won't enable privileged mode.
     98   HRESULT GetWantsPrivileged([out] boolean *wants_privileged);
     99   // The profile name we want to use.
    100   HRESULT GetChromeProfileName([out] BSTR *profile_name);
    101   // Called when an automation version mismatch occurs. Returns S_OK if
    102   // a dialog should be showed to the user by this CF instance, S_FALSE if
    103   // not.
    104   HRESULT ShouldShowVersionMismatchDialog();
    105   // Allows the host to return the navigation url during the creation of the
    106   // ChromeFrameActiveX instance.
    107   HRESULT GetNavigationUrl([out] BSTR* url);
    108 };
    109 
    110 // Expose this service to the ChromeFrame control to trigger privileged
    111 // mode. If the control is in privileged mode, it will forward messages
    112 // to the onmessage handler irrespective of origin.
    113 cpp_quote("#define SID_ChromeFramePrivileged __uuidof(IChromeFramePrivileged)")
    114 
    115 typedef enum {
    116   CF_EVENT_DISPID_ONLOAD = 1,
    117   CF_EVENT_DISPID_ONLOADERROR,
    118   CF_EVENT_DISPID_ONMESSAGE,
    119   CF_EVENT_DISPID_ONPRIVATEMESSAGE,
    120   CF_EVENT_DISPID_ONCHANNELERROR,
    121   CF_EVENT_DISPID_ONCLOSE,
    122   CF_EVENT_DISPID_ONREADYSTATECHANGED = DISPID_READYSTATECHANGE,
    123 } ChromeFrameEventDispId;
    124 
    125 [
    126   uuid(6F2664E1-FF6E-488A-BCD1-F4CA6001DFCC),
    127   version(1.0),
    128   helpstring("ChromeTab 1.0 Type Library")
    129 ]
    130 library ChromeTabLib {
    131   importlib("stdole2.tlb");
    132 
    133   [uuid(388B5D64-CE67-415b-9B0F-745C56E868E7)]
    134   dispinterface DIChromeFrameEvents {
    135    properties:
    136     // None.
    137 
    138    methods:
    139     [id(CF_EVENT_DISPID_ONLOAD)]
    140     void onload();
    141     
    142     [id(CF_EVENT_DISPID_ONLOADERROR)]
    143     void onloaderror();
    144     
    145     [id(CF_EVENT_DISPID_ONMESSAGE)]
    146     void onmessage([in] IDispatch* event);
    147     
    148     [id(CF_EVENT_DISPID_ONREADYSTATECHANGED)]
    149     void onreadystatechanged();
    150     
    151     [id(CF_EVENT_DISPID_ONPRIVATEMESSAGE)]
    152     // This event is only fired when the control is in privileged mode.
    153     void onprivatemessage([in] IDispatch* event, [in] BSTR target);
    154 
    155     [id(CF_EVENT_DISPID_ONCHANNELERROR)]
    156     // This event is fired when there is an error in communication channel with
    157     // Chrome and Automation must be reconnected to continue.
    158     void onchannelerror();
    159 
    160     [id(CF_EVENT_DISPID_ONCLOSE)]
    161     // This event is fired when the script inside the page wants to close it.
    162     // This is just a notification, there is no way to prevent the script from
    163     // closing.
    164     void onclose();
    165   };
    166 
    167   [uuid(BB1176EE-20DD-41DC-9D1E-AC1335C7BBB0)]
    168   coclass HtmlFilter {
    169     [default] interface IUnknown;
    170   };
    171 
    172   [uuid(9875BFAF-B04D-445E-8A69-BE36838CDE3E)]
    173   coclass ChromeProtocol {
    174     [default] interface IUnknown;
    175   };
    176 
    177   [uuid(3E1D0E7F-F5E3-44CC-AA6A-C0A637619AB8), control]
    178   coclass ChromeActiveDocument {
    179     [default] interface IChromeFrame;
    180   };
    181 
    182   [uuid(E0A900DF-9611-4446-86BD-4B1D47E7DB2A), control]
    183   coclass ChromeFrame {
    184     [default] interface IChromeFrame;
    185     [default, source] dispinterface DIChromeFrameEvents;
    186   };
    187 
    188   [uuid(ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7)]
    189   coclass ChromeFrameBHO {
    190     [default] interface IUnknown;
    191   };
    192 };
    193