Home | History | Annotate | Download | only in google_update
      1 // Copyright 2009-2010 Google Inc.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //      http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 // ========================================================================
     15 
     16 import "oaidl.idl";
     17 import "ocidl.idl";
     18 
     19 // When adding interfaces to this file:
     20 //  * Do not use "Google" or "GoogleUpdate" directly. Instead, use preprocessor
     21 //    defines.
     22 //  * Add a test for the Google-specific value to
     23 //    omaha_customization_goopdate_apis_unittest.cc.
     24 
     25 //
     26 // Enums.
     27 // These values can be passed to interface methods and/or compared to their
     28 // output.
     29 //
     30 
     31 // Must be kept in sync with the enum in base/browser_utils.h.
     32 typedef enum BrowserType {
     33   BROWSER_UNKNOWN           = 0,
     34   BROWSER_DEFAULT           = 1,
     35   BROWSER_INTERNET_EXPLORER = 2,
     36   BROWSER_FIREFOX           = 3,
     37   BROWSER_CHROME            = 4,
     38 } BrowserType;
     39 
     40 // The normal install flow proceeds from STATE_INIT through
     41 // STATE_INSTALL_COMPLETE in order, skipping states that are not relevant.
     42 // All exceptions and terminal states are start with STATE_INSTALL_COMPLETE.
     43 typedef enum CurrentState {
     44   STATE_INIT = 1,
     45   STATE_WAITING_TO_CHECK_FOR_UPDATE = 2,
     46   STATE_CHECKING_FOR_UPDATE = 3,
     47   STATE_UPDATE_AVAILABLE = 4,
     48   STATE_WAITING_TO_DOWNLOAD = 5,
     49   STATE_RETRYING_DOWNLOAD = 6,
     50   STATE_DOWNLOADING = 7,
     51   STATE_DOWNLOAD_COMPLETE = 8,
     52   STATE_EXTRACTING = 9,
     53   STATE_APPLYING_DIFFERENTIAL_PATCH = 10,
     54   // TODO(omaha3): Should we move STATE_DOWNLOAD_COMPLETE here and eliminate
     55   // STATE_READY_TO_INSTALL?
     56   STATE_READY_TO_INSTALL = 11,
     57   STATE_WAITING_TO_INSTALL = 12,
     58   STATE_INSTALLING = 13,
     59   STATE_INSTALL_COMPLETE = 14,
     60   STATE_PAUSED = 15,
     61   STATE_NO_UPDATE = 16,
     62   STATE_ERROR = 17,
     63 } CurrentState;
     64 
     65 typedef enum InstallPriority {
     66   INSTALL_PRIORITY_LOW = 0,
     67   INSTALL_PRIORITY_HIGH = 10,
     68 } InstallPriority;
     69 
     70 // Specifies what the client should do after installation.
     71 typedef enum PostInstallAction {
     72   POST_INSTALL_ACTION_DEFAULT = 0,
     73 
     74   // Caller should exit silently.
     75   POST_INSTALL_ACTION_EXIT_SILENTLY = 1,
     76 
     77   // Caller should launch the command.
     78   POST_INSTALL_ACTION_LAUNCH_COMMAND = 2,
     79 
     80   // Caller should launch the command and exit silently.
     81   POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND = 3,
     82 
     83   // The caller should ask the user to restart the browser. If the value of
     84   // IApp's browser is supported and postInstallUrl is valid, the client should
     85   // offer to restart the browser. If the user chooses to do so, the client
     86   // should launch the ICurrentState::postInstallUrl after shutting down and
     87   // restarting the browser.
     88   POST_INSTALL_ACTION_RESTART_BROWSER = 4,
     89 
     90   // Similar to POST_INSTALL_ACTION_RESTART_BROWSER, but ask the user to shut
     91   // down all browsers.
     92   POST_INSTALL_ACTION_RESTART_ALL_BROWSERS = 5,
     93 
     94   // The caller should ask the user to reboot the machine.
     95   POST_INSTALL_ACTION_REBOOT = 6,
     96 } PostInstallAction;
     97 
     98 enum AppCommandStatus {
     99   // The command has never been executed.
    100   COMMAND_STATUS_INIT = 1,
    101   // The command is running.
    102   COMMAND_STATUS_RUNNING = 2,
    103   // An error occurred while launching or monitoring the command.
    104   COMMAND_STATUS_ERROR = 3,
    105   // The command has completed execution.
    106   COMMAND_STATUS_COMPLETE = 4,
    107 };
    108 
    109 [
    110   object,
    111   dual,
    112   uuid(6DB17455-4E85-46e7-9D23-E555E4B005AF),
    113   helpstring("IGoogleUpdate3 Interface"),
    114   pointer_default(unique)
    115 ]
    116 interface IGoogleUpdate3 : IDispatch {
    117   // TODO(Omaha): Perhaps this interface exposes helpers such as
    118   // RestartBrowsers, etc.
    119 
    120   // Returns the count of the AppBundles in this IGoogleUpdate3 interface.
    121   [id(1), propget] HRESULT Count([out, retval] long* count);
    122 
    123   // Returns an IDispatch of the AppBundle in this IGoogleUpdate3 interface at
    124   // the specified 0-based index. This property has the dispid of DISPID_VALUE
    125   // to make it the default property of IGoogleUpdate3.
    126   [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
    127                                            [out, retval] IDispatch** bundle);
    128   // Returns an IDispatch to a newly created empty AppBundle.
    129   [id(2)] HRESULT createAppBundle([out, retval] IDispatch** app_bundle);
    130 }
    131 
    132 [
    133   object,
    134   dual,
    135   uuid(fe908cdd-22bb-472a-9870-1a0390e42f36),
    136   helpstring("IAppBundle Interface"),
    137   pointer_default(unique)
    138 ]
    139 interface IAppBundle : IDispatch {
    140   // TODO(omaha3): AppBundle::display_name_ is never used. Should we remove?
    141   [propget] HRESULT displayName([out, retval] BSTR*);
    142   [propput] HRESULT displayName([in] BSTR);
    143 
    144   [propget] HRESULT displayLanguage([out, retval] BSTR*);
    145   [propput] HRESULT displayLanguage([in] BSTR);
    146 
    147   [propget] HRESULT installSource([out, retval] BSTR*);
    148   [propput] HRESULT installSource([in] BSTR);
    149 
    150   [propget] HRESULT originURL([out, retval] BSTR*);
    151   [propput] HRESULT originURL([in] BSTR);
    152 
    153   [propget] HRESULT offlineDirectory([out, retval] BSTR* offline_dir);
    154   [propput] HRESULT offlineDirectory([in] BSTR offline_dir);
    155 
    156   [propget] HRESULT sessionId([out, retval] BSTR* session_id);
    157   [propput] HRESULT sessionId([in] BSTR session_id);
    158 
    159   // Controls whether or not event pings should be sent at the end of
    160   // an operation.
    161   [propget] HRESULT sendPings([out, retval] VARIANT_BOOL* send_pings);
    162   [propput] HRESULT sendPings([in] VARIANT_BOOL send_pings);
    163 
    164   // The priority property determines download speed/priority and the number/
    165   // frequency of retries.  Use values from the InstallPriority enum.
    166   [propget] HRESULT priority([out, retval] long* priority);
    167   [propput] HRESULT priority([in] long priority);
    168 
    169   // Returns the count of the Apps in the AppBundle.
    170   [id(1), propget] HRESULT Count([out, retval] long* count);
    171 
    172   // Returns an IDispatch of the App in the AppBundle at the specified 0-based
    173   // index. This property has the dispid of DISPID_VALUE to make it the default
    174   // property of IAppBundle.
    175   [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
    176                                            [out, retval] IDispatch** app);
    177 
    178   // Impersonation and primary tokens set by the client. Typically only
    179   // set by the gupdatem service. The gupdatem service exposes a narrow
    180   // interface to medium integrity clients. When a medium integrity client calls
    181   // into the gupdatem service, the gupdatem service captures the token of the
    182   // caller, and then calls put_altTokens() on the gupdate service, so that the
    183   // gupdate service can use it for future download() and install() requests.
    184   [propput] HRESULT altTokens([in] ULONG_PTR impersonation_token,
    185                               [in] ULONG_PTR primary_token,
    186                               [in] DWORD caller_proc_id);
    187 
    188   // Sets a HWND to associate with the client, if any.  This will be used as
    189   // the parent window for any dialogs that the server may need to display.
    190   [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
    191 
    192   // Initializes the bundle with the properties that have been set.
    193   [id(2)] HRESULT initialize();
    194 
    195   // Returns an IDispatch to a new App for the specified app id.
    196   // The App is added to the Bundle.
    197   [id(3)] HRESULT createApp([in] BSTR app_id,
    198                             [out, retval] IDispatch** app);
    199 
    200   // Returns an IDispatch to a newly created App for the specified app ID. The
    201   // App is populated with information from the existing installation and added
    202   // to the Bundle. Fails if the specified app is not installed.
    203   [id(4)] HRESULT createInstalledApp([in] BSTR app_id,
    204                                      [out, retval] IDispatch** app);
    205 
    206   // Creates App instances for all installed apps managed by this Omaha
    207   // instance. Each App is populated with information from the existing install.
    208   [id(5)] HRESULT createAllInstalledApps();
    209 
    210   // These methods are non-blocking. The operation is scheduled.
    211   [id(6)] HRESULT checkForUpdate();
    212   [id(7)] HRESULT download();
    213   [id(8)] HRESULT install();
    214 
    215   // All-in-one function for automatically updating all apps. Populates the
    216   // bundle then schedules the update, which includes the update check and
    217   // download and install, if necessary.
    218   [id(9)] HRESULT updateAllApps();
    219 
    220   // These three methods are non-blocking. The operation is requested.
    221   [id(10)] HRESULT stop();
    222   [id(11)] HRESULT pause();
    223   [id(12)] HRESULT resume();
    224 
    225   // Returns true if the bundle has an uncompleted non-blocking request.
    226   [id(13)] HRESULT isBusy([out, retval] VARIANT_BOOL* is_busy);
    227 
    228   // Downloads a package of an installed application.
    229   [id(14)] HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
    230 
    231   // TODO(omaha): Define this aggregated bundle state. Is this really a property
    232   // or should it be getCurrentState?
    233   // The server and bundle are the only thing that can provide aggregated
    234   // time estimates for downloads. Also, aggregate percentage is not currently
    235   // available to the client because the total bytes to download is not
    236   // available from App in all post-update check states.
    237   // To do this, we will probably need to know the total expected download
    238   // size for all packages to be installed - those that are required or in use -
    239   // by the time the update check phase is complete.
    240   [id(15), propget] HRESULT currentState([out, retval] VARIANT* current_state);
    241 };
    242 
    243 [
    244   object,
    245   dual,
    246   uuid(76F7B787-A67C-4c73-82C7-31F5E3AABC5C),
    247   helpstring("IApp Interface"),
    248   pointer_default(unique)
    249 ]
    250 interface IApp : IDispatch {
    251   // Returns a version IDispatch object.
    252   [id(1), propget] HRESULT currentVersion([out, retval] IDispatch** current);
    253   [id(2), propget] HRESULT nextVersion([out, retval] IDispatch** next);
    254 
    255   [propget] HRESULT appId([out, retval] BSTR*);
    256 
    257   [propget] HRESULT displayName([out, retval] BSTR*);
    258   [propput] HRESULT displayName([in] BSTR);
    259 
    260   [propget] HRESULT language([out, retval] BSTR*);
    261   [propput] HRESULT language([in] BSTR);
    262 
    263   [propget] HRESULT ap([out, retval] BSTR*);
    264   [propput] HRESULT ap([in] BSTR);
    265 
    266   [propget] HRESULT ttToken([out, retval] BSTR*);
    267   [propput] HRESULT ttToken([in] BSTR);
    268 
    269   [propget] HRESULT iid([out, retval] BSTR*);
    270   [propput] HRESULT iid([in] BSTR);
    271 
    272   [propget] HRESULT brandCode([out, retval] BSTR*);
    273   [propput] HRESULT brandCode([in] BSTR);
    274 
    275   [propget] HRESULT clientId([out, retval] BSTR*);
    276   [propput] HRESULT clientId([in] BSTR);
    277 
    278   [propget] HRESULT labels([out, retval] BSTR*);
    279   [propput] HRESULT labels([in] BSTR);
    280 
    281   [propget] HRESULT referralId([out, retval] BSTR*);
    282   [propput] HRESULT referralId([in] BSTR);
    283 
    284   // Returns an IDispatch to a command defined by this installed app with the
    285   // specified ID, or NULL if this app is not installed or the command ID is not
    286   // recognized.
    287   [propget] HRESULT command([in] BSTR command_id,
    288                             [out, retval] IDispatch** command);
    289 
    290   // Use values from the BrowserType enum.
    291   [propget] HRESULT browserType([out, retval] UINT*);
    292   [propput] HRESULT browserType([in] UINT);
    293 
    294   [propget] HRESULT clientInstallData([out, retval] BSTR*);
    295   [propput] HRESULT clientInstallData([in] BSTR);
    296 
    297   [propget] HRESULT serverInstallDataIndex([out, retval] BSTR*);
    298   [propput] HRESULT serverInstallDataIndex([in] BSTR);
    299 
    300   // Set as soon as possible. Error pings are disabled until set to true.
    301   [propget] HRESULT isEulaAccepted([out, retval] VARIANT_BOOL*);
    302   [propput] HRESULT isEulaAccepted([in] VARIANT_BOOL);
    303 
    304   [propget] HRESULT usageStatsEnable([out, retval] UINT*);
    305   [propput] HRESULT usageStatsEnable([in] UINT);
    306 
    307   [propget] HRESULT installTimeDiffSec([out, retval] UINT*);
    308 
    309   // Returns an ICurrentState interface. The object underlying the interface has
    310   // static data that does not get updated as the server state changes. To get
    311   // the most "current" state, the currentState property needs to be queried
    312   // again.
    313   [propget] HRESULT currentState([out, retval] IDispatch**);
    314 };
    315 
    316 [
    317   object,
    318   dual,
    319   uuid(4DE778FE-F195-4ee3-9DAB-FE446C239221),
    320   helpstring("IAppCommand Interface"),
    321   pointer_default(unique)
    322 ]
    323 interface IAppCommand : IDispatch {
    324   [propget] HRESULT isWebAccessible([out, retval] VARIANT_BOOL*);
    325   // Use values from the AppCommandStatus enum.
    326   [propget] HRESULT status([out, retval] UINT*);
    327   [propget] HRESULT exitCode([out, retval] DWORD*);
    328   HRESULT execute([in, optional] VARIANT arg1,
    329                   [in, optional] VARIANT arg2,
    330                   [in, optional] VARIANT arg3,
    331                   [in, optional] VARIANT arg4,
    332                   [in, optional] VARIANT arg5,
    333                   [in, optional] VARIANT arg6,
    334                   [in, optional] VARIANT arg7,
    335                   [in, optional] VARIANT arg8,
    336                   [in, optional] VARIANT arg9);
    337 };
    338 
    339 [
    340   object,
    341   dual,
    342   uuid(BCDCB538-01C0-46d1-A6A7-52F4D021C272),
    343   helpstring("IAppVersion Interface"),
    344   pointer_default(unique)
    345 ]
    346 interface IAppVersion : IDispatch {
    347   [propget] HRESULT version([out, retval] BSTR*);
    348 
    349   // [propget] HRESULT installManifest([out, retval] BSTR*);
    350 
    351   // Returns the count of the Packages in the AppVersion.
    352   [propget] HRESULT packageCount([out, retval] long* count);
    353 
    354   // Returns an IDispatch of the Package in the AppVersion at the specified
    355   // 0-based index.
    356   [propget] HRESULT package([in] long index,
    357                             [out, retval] IDispatch** package);
    358 };
    359 
    360 [
    361   object,
    362   dual,
    363   uuid(DCAB8386-4F03-4dbd-A366-D90BC9F68DE6),
    364   helpstring("IPackage Interface"),
    365   pointer_default(unique)
    366 ]
    367 interface IPackage : IDispatch {
    368   // Retrieves the package from the package cache and copies it to the
    369   // directory provided. Returns an error is the package is not available
    370   // locally.
    371   [id(1)] HRESULT get([in] BSTR dir);
    372 
    373   // Returns true if the package has been downloaded and is available
    374   // locally.
    375   [propget] HRESULT isAvailable([out, retval] VARIANT_BOOL*);
    376 
    377   // Returns the manifest name of the package.
    378   [propget] HRESULT filename([out, retval] BSTR*);
    379 };
    380 
    381 // TODO(omaha3): We should figure out what else we are going to want in this
    382 // interface before dogfood even if we do not implement it.
    383 [
    384   object,
    385   dual,
    386   uuid(247954F9-9EDC-4E68-8CC3-150C2B89EADF),
    387   helpstring("ICurrentState Interface"),
    388   pointer_default(unique)
    389 ]
    390 interface ICurrentState : IDispatch {
    391   // This interface is exposed to web clients!
    392   // TODO(omaha3): Update valid comments once we settle on an implementation.
    393 
    394   // A value from the CurrentState enum. This value determines which of the
    395   // properties below are valid.
    396   [propget] HRESULT stateValue([out, retval] LONG*);
    397 
    398   // The remaining properties are only valid in the specified states. For all
    399   // other states, the values are not specified.
    400 
    401   // This property is valid only when stateValue is STATE_UPDATE_AVAILABLE.
    402   [propget] HRESULT availableVersion([out, retval] BSTR*);
    403 
    404   // The following three properties are only valid when stateValue is
    405   // STATE_WAITING_TO_DOWNLOAD, STATE_RETRYING_DOWNLOAD, STATE_DOWNLOADING,
    406   // STATE_DOWNLOAD_COMPLETE, STATE_EXTRACTING,
    407   // STATE_APPLYING_DIFFERENTIAL_PATCH, or STATE_READY_TO_INSTALL.
    408 
    409   // Bytes downloaded so far.
    410   [propget] HRESULT bytesDownloaded([out, retval] ULONG*);
    411 
    412   // Total bytes to download.
    413   [propget] HRESULT totalBytesToDownload([out, retval] ULONG*);
    414 
    415   // Estimated download time remaining in ms. -1 indicates unknown.
    416   // Progress may not always be available, so clients should handle the -1 case.
    417   [propget] HRESULT downloadTimeRemainingMs([out, retval] LONG*);
    418 
    419   [propget] HRESULT nextRetryTime([out, retval] ULONGLONG*);
    420 
    421   // TODO(omaha 3): Need some way to indicate reconnecting, retrying, etc.
    422 
    423   // The following two properties are only valid when stateValue is
    424   // STATE_INSTALLING or STATE_INSTALL_COMPLETE.
    425 
    426   // Current install progress in percentage from 0 to 100. -1 indicates unknown.
    427   // Progress may not always be available, so clients should handle the -1 case.
    428   [propget] HRESULT installProgress([out, retval] LONG*);
    429 
    430   // Estimated download time remaining in ms. -1 indicates unknown.
    431   // Progress may not always be available, so clients should handle the -1 case.
    432   [propget] HRESULT installTimeRemainingMs([out, retval] LONG*);
    433 
    434   // The following four properties are only valid when stateValue is
    435   // STATE_ERROR:
    436 
    437   // Returns true if the app has been canceled.
    438   [propget] HRESULT isCanceled([out, retval] VARIANT_BOOL* is_canceled);
    439 
    440   // Error code.
    441   [propget] HRESULT errorCode([out, retval] LONG*);
    442 
    443   // Error extra code.
    444   [propget] HRESULT extraCode1([out, retval] LONG*);
    445 
    446   // The following three properties are only valid when stateValue is
    447   // STATE_ERROR or STATE_INSTALL_COMPLETE.
    448   // TODO(omaha3): If STATE_DOWNLOAD_COMPLETE or STATE_READY_TO_INSTALL becomes
    449   // a terminal state, does it support completion messages?
    450 
    451   // Completion message, localized in the specified language.
    452   // TODO(omaha3): If we're going to have bundle error messages too, should the
    453   // language be at bundle level? Should bundle have its own language setter?
    454   [propget] HRESULT completionMessage([out, retval] BSTR*);
    455 
    456   // Application installer result code. This is to be used as additional
    457   // information only. Success/failure should be determined using errorCode.
    458   // This is an error if errorCode is GOOPDATEINSTALL_E_INSTALLER_FAILED.
    459   [propget] HRESULT installerResultCode([out, retval] LONG*);
    460 
    461   // Application installer extra code.
    462   [propget] HRESULT installerResultExtraCode1([out, retval] LONG*);
    463 
    464   // A command that needs to be launched by the client after installation.
    465   [propget] HRESULT postInstallLaunchCommandLine([out, retval] BSTR*);
    466 
    467   // URL to be launched after restarting the browser.
    468   [propget] HRESULT postInstallUrl([out, retval] BSTR*);
    469 
    470   // Returns a PostInstallAction value indicating the action to be taken by the
    471   // client after installation.
    472   [propget] HRESULT postInstallAction([out, retval] LONG*);
    473 }
    474 
    475 [
    476   object,
    477   dual,
    478   uuid(4E223325-C16B-4eeb-AEDC-19AA99A237FA),
    479   helpstring("IRegistrationUpdateHook Interface"),
    480   pointer_default(unique)
    481 ]
    482 interface IRegistrationUpdateHook : IDispatch {
    483   HRESULT UpdateRegistry([in] BSTR app_id, [in] VARIANT_BOOL is_machine);
    484 };
    485 
    486 [
    487   object,
    488   uuid(b3a47570-0a85-4aea-8270-529d47899603),
    489   helpstring("ICredentialDialog Interface"),
    490   pointer_default(unique)
    491 ]
    492 interface ICredentialDialog : IUnknown {
    493   HRESULT QueryUserForCredentials([in] ULONG_PTR owner_hwnd,
    494                                   [in] BSTR server,
    495                                   [in] BSTR message,
    496                                   [out] BSTR* username,
    497                                   [out] BSTR* password);
    498 };
    499 
    500 // BEGIN gupdatem interfaces.
    501 
    502 // The following interfaces are exposed as a narrower version of the
    503 // IGoogleUpdate3 interface from the gupdatem service. These interfaces are
    504 // meant for use from medium and low integrity clients.
    505 
    506 [
    507   object,
    508   dual,
    509   uuid(494B20CF-282E-4BDD-9F5D-B70CB09D351E),
    510   helpstring("IGoogleUpdate3Web Interface"),
    511   pointer_default(unique)
    512 ]
    513 interface IGoogleUpdate3Web : IDispatch {
    514   HRESULT createAppBundleWeb([out, retval] IDispatch** app_bundle_web);
    515 };
    516 
    517 [
    518   object,
    519   uuid(2D363682-561D-4c3a-81C6-F2F82107562A),
    520   helpstring("IGoogleUpdate3WebSecurity Interface"),
    521   pointer_default(unique)
    522 ]
    523 interface IGoogleUpdate3WebSecurity : IUnknown {
    524   HRESULT setOriginURL([in] BSTR origin_url);
    525 };
    526 
    527 [
    528   object,
    529   dual,
    530   uuid(DD42475D-6D46-496a-924E-BD5630B4CBBA),
    531   helpstring("IAppBundleWeb Interface"),
    532   pointer_default(unique)
    533 ]
    534 interface IAppBundleWeb : IDispatch {
    535   [id(2)] HRESULT createApp([in] BSTR app_guid,
    536                             [in] BSTR brand_code,
    537                             [in] BSTR language,
    538                             [in] BSTR ap);
    539   [id(3)] HRESULT createInstalledApp([in] BSTR app_id);
    540   [id(4)] HRESULT createAllInstalledApps();
    541 
    542   [propget] HRESULT displayLanguage([out, retval] BSTR*);
    543   [propput] HRESULT displayLanguage([in] BSTR);
    544 
    545   [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
    546 
    547   [propget] HRESULT length([out, retval] int* index);
    548   [id(DISPID_VALUE), propget] HRESULT appWeb(
    549       [in] int index, [out, retval] IDispatch** app_web);
    550 
    551   HRESULT initialize();
    552 
    553   HRESULT checkForUpdate();
    554   HRESULT download();
    555   HRESULT install();
    556 
    557   HRESULT pause();
    558   HRESULT resume();
    559   HRESULT cancel();
    560 
    561   HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
    562 
    563   [propget] HRESULT currentState([out, retval] VARIANT* current_state);
    564 };
    565 
    566 [
    567   object,
    568   dual,
    569   uuid(18D0F672-18B4-48e6-AD36-6E6BF01DBBC4),
    570   helpstring("IAppWeb Interface"),
    571   pointer_default(unique)
    572 ]
    573 interface IAppWeb : IDispatch {
    574   [propget] HRESULT appId([out, retval] BSTR*);
    575 
    576   // Returns an IAppVersionWeb IDispatch object.
    577   [propget] HRESULT currentVersionWeb([out, retval] IDispatch** current);
    578   [propget] HRESULT nextVersionWeb([out, retval] IDispatch** next);
    579 
    580   // Returns an IAppCommandWeb IDispatch object, or NULL.
    581   [propget] HRESULT command([in] BSTR command_id,
    582                             [out, retval] IDispatch** command);
    583 
    584   HRESULT cancel();
    585   [propget] HRESULT currentState([out, retval] IDispatch** current_state);
    586   HRESULT launch();
    587   HRESULT uninstall();
    588 };
    589 
    590 [
    591   object,
    592   dual,
    593   uuid(68D6C2BD-712E-4c96-93E8-49CB8A9AAEED),
    594   helpstring("IAppCommandWeb Interface"),
    595   pointer_default(unique)
    596 ]
    597 interface IAppCommandWeb : IDispatch {
    598   // Use values from the AppCommandStatus enum.
    599   [propget] HRESULT status([out, retval] UINT*);
    600   [propget] HRESULT exitCode([out, retval] DWORD*);
    601   HRESULT execute([in, optional] VARIANT arg1,
    602                   [in, optional] VARIANT arg2,
    603                   [in, optional] VARIANT arg3,
    604                   [in, optional] VARIANT arg4,
    605                   [in, optional] VARIANT arg5,
    606                   [in, optional] VARIANT arg6,
    607                   [in, optional] VARIANT arg7,
    608                   [in, optional] VARIANT arg8,
    609                   [in, optional] VARIANT arg9);
    610 };
    611 
    612 [
    613   object,
    614   dual,
    615   uuid(0CD01D1E-4A1C-489d-93B9-9B6672877C57),
    616   helpstring("IAppVersionWeb Interface"),
    617   pointer_default(unique)
    618 ]
    619 interface IAppVersionWeb : IDispatch {
    620   [propget] HRESULT version([out, retval] BSTR*);
    621 
    622   // Returns the count of the Packages in the AppVersion.
    623   [propget] HRESULT packageCount([out, retval] long* count);
    624 
    625   // TODO(omaha3): Implement this after a security review.
    626   // Returns an IDispatch of the Package in the AppVersion at the specified
    627   // 0-based index.
    628   [propget] HRESULT packageWeb([in] long index,
    629                                [out, retval] IDispatch** package);
    630 };
    631 
    632 [
    633   object,
    634   dual,
    635   uuid(2E629606-312A-482f-9B12-2C4ABF6F0B6D),
    636   helpstring("ICoCreateAsyncStatus Interface"),
    637   pointer_default(unique)
    638 ]
    639 interface ICoCreateAsyncStatus : IDispatch {
    640   [propget] HRESULT isDone([out, retval] VARIANT_BOOL* is_done);
    641   [propget] HRESULT completionHResult([out, retval] LONG* hr);
    642   [propget] HRESULT createdInstance([out, retval] IDispatch** instance);
    643 };
    644 
    645 [
    646   object,
    647   uuid(DAB1D343-1B2A-47f9-B445-93DC50704BFE),
    648   helpstring("ICoCreateAsync Interface"),
    649   pointer_default(unique)
    650 ]
    651 interface ICoCreateAsync : IUnknown {
    652   HRESULT createOmahaMachineServerAsync(
    653       [in] BSTR origin_url,
    654       [in] BOOL create_elevated,
    655       [out, retval] ICoCreateAsyncStatus** status);
    656 };
    657 
    658 // END gupdatem interfaces.
    659 
    660 // BEGIN Legacy google_update_idl interfaces.
    661 
    662 [
    663   object,
    664   uuid(5B25A8DC-1780-4178-A629-6BE8B8DEFAA2),
    665   oleautomation,
    666   nonextensible,
    667   pointer_default(unique)
    668 ]
    669 interface IBrowserHttpRequest2 : IUnknown {
    670   // This method will send request/data from the browser process.
    671   // @param url                     URL where request will be send.
    672   // @param post_data               POST data, if any. Can be NULL.
    673   // @param request_headers         HTTP request headers, if any. Can be NULL.
    674   // @param response_headers_needed HTTP response headers that are needed.
    675   //                                Should be one of the values listed here:
    676   //                                    http://msdn.microsoft.com/aa385351.aspx
    677   //                                The input is a SAFEARRAY of DWORD. Can be a
    678   //                                VT_EMPTY.
    679   // @param response_headers        HTTP response headers, returned as SAFEARRAY
    680   //                                of BSTR. The values corresponding one-to-one
    681   //                                with the response_headers_needed values. Can
    682   //                                be NULL if response_headers_needed==VT_EMPTY
    683   // @param response_code           HTTP response code.
    684   // @param cache_filename          Cache file that contains the response data.
    685   HRESULT Send([in] BSTR url,
    686                [in] BSTR post_data,
    687                [in] BSTR request_headers,
    688                [in] VARIANT response_headers_needed,
    689                [out] VARIANT* response_headers,
    690                [out] DWORD* response_code,
    691                [out] BSTR* cache_filename);
    692 };
    693 
    694 [
    695   object,
    696   oleautomation,
    697   uuid(128C2DA6-2BC0-44c0-B3F6-4EC22E647964),
    698   helpstring("Google Update IProcessLauncher Interface"),
    699   pointer_default(unique)
    700 ]
    701 interface IProcessLauncher : IUnknown {
    702   // @param cmd_line The full command line to execute.
    703   HRESULT LaunchCmdLine([in, string] const WCHAR* cmd_line);
    704 
    705   // @param browser_type The browser to start.
    706   // @param url The url to launch the browser with.
    707   HRESULT LaunchBrowser([in] DWORD browser_type,
    708                         [in, string] const WCHAR* url);
    709 
    710   // @param app_id Unique id to identify the calling client application
    711   // @param event_id Unique id for the command
    712   // @param caller_proc_id The process id of the calling process
    713   // @param proc_handle The process handle valid in the caller's context
    714   HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
    715                             [in, string] const WCHAR* cmd_id,
    716                             [in] DWORD caller_proc_id,
    717                             [out] ULONG_PTR* proc_handle);
    718 };
    719 
    720 [
    721   object,
    722   oleautomation,
    723   uuid(5CCCB0EF-7073-4516-8028-4C628D0C8AAB),
    724   helpstring("Google Update IOneClickProcessLauncher Interface"),
    725   pointer_default(unique)
    726 ]
    727 interface IOneClickProcessLauncher : IUnknown {
    728   HRESULT LaunchAppCommand([in, string] const WCHAR* app_guid,
    729                            [in, string] const WCHAR* cmd_id);
    730 };
    731 
    732 typedef enum {
    733   COMPLETION_CODE_SUCCESS = 1,
    734   COMPLETION_CODE_SUCCESS_CLOSE_UI,
    735   COMPLETION_CODE_ERROR,
    736   COMPLETION_CODE_RESTART_ALL_BROWSERS,
    737   COMPLETION_CODE_REBOOT,
    738   COMPLETION_CODE_RESTART_BROWSER,
    739   COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
    740   COMPLETION_CODE_REBOOT_NOTICE_ONLY,
    741   COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
    742   COMPLETION_CODE_RUN_COMMAND,
    743 } LegacyCompletionCodes;
    744 
    745 [
    746   object,
    747   oleautomation,
    748   uuid(1C642CED-CA3B-4013-A9DF-CA6CE5FF6503),
    749   helpstring("GoogleUpdate UI-specific events Interface"),
    750   pointer_default(unique)
    751 ]
    752 interface IProgressWndEvents : IUnknown {
    753   // The UI is closing down. The user has clicked on either the "X" or the
    754   // other buttons of the UI to close the window.
    755   HRESULT DoClose();
    756 
    757   // Pause has been clicked on.
    758   HRESULT DoPause();
    759 
    760   // Resume has been clicked on.
    761   HRESULT DoResume();
    762 
    763   // RestartBrowsers button has been clicked on.
    764   HRESULT DoRestartBrowsers();
    765 
    766   // Reboot button has been clicked on.
    767   HRESULT DoReboot();
    768 
    769   // Launch Browser.
    770   HRESULT DoLaunchBrowser([in, string] const WCHAR* url);
    771 };
    772 
    773 
    774 [
    775   object,
    776   oleautomation,
    777   uuid(49D7563B-2DDB-4831-88C8-768A53833837),
    778   helpstring("IJobObserver Interface"),
    779   pointer_default(unique)
    780 ]
    781 interface IJobObserver : IUnknown {
    782   HRESULT OnShow();
    783   HRESULT OnCheckingForUpdate();
    784   HRESULT OnUpdateAvailable([in, string] const WCHAR* version_string);
    785   HRESULT OnWaitingToDownload();
    786   HRESULT OnDownloading([in] int time_remaining_ms, [in] int pos);
    787   HRESULT OnWaitingToInstall();
    788   HRESULT OnInstalling();
    789   HRESULT OnPause();
    790   HRESULT OnComplete([in] LegacyCompletionCodes code,
    791                      [in, string] const WCHAR* completion_text);
    792   HRESULT SetEventSink([in] IProgressWndEvents* ui_sink);
    793 };
    794 
    795 [
    796   object,
    797   oleautomation,
    798   uuid(31AC3F11-E5EA-4a85-8A3D-8E095A39C27B),
    799   helpstring("IGoogleUpdate Interface"),
    800   pointer_default(unique)
    801 ]
    802 interface IGoogleUpdate : IUnknown {
    803   // @param guid The guid for the app to be updated.
    804   // @param observer The eventing interface.
    805   HRESULT CheckForUpdate([in, string] const WCHAR* guid,
    806                          [in] IJobObserver* observer);
    807 
    808   // @param guid The guid for the app to be updated.
    809   // @param observer The eventing interface.
    810   HRESULT Update([in, string] const WCHAR* guid,
    811                  [in] IJobObserver* observer);
    812 };
    813 
    814 // IGoogleUpdateCore is an internal Omaha interface.
    815 [
    816   object,
    817   oleautomation,
    818   uuid(909489C2-85A6-4322-AA56-D25278649D67),
    819   helpstring("Google Update Core Interface"),
    820   pointer_default(unique)
    821 ]
    822 interface IGoogleUpdateCore : IUnknown
    823 {
    824   // Runs a command elevated.
    825   //
    826   // @param app_id Unique id to identify the calling client application
    827   // @param event_id Unique id for the command
    828   // @param caller_proc_id The process id of the calling process
    829   // @param proc_handle The process handle valid in the caller's context
    830   HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
    831                             [in, string] const WCHAR* cmd_id,
    832                             [in] DWORD caller_proc_id,
    833                             [out] ULONG_PTR* proc_handle);
    834 };
    835 
    836 // END Legacy google_update_idl interfaces.
    837 
    838 [
    839   uuid(655DD85A-3C0D-4674-9C58-AF7168C5861E),
    840   version(1.0),
    841   helpstring("Google Update 3.0 Type Library")
    842 ]
    843 library GoogleUpdate3Lib {
    844   importlib("stdole2.tlb");
    845 
    846   // These Interfaces are forward declared to ensure that they are described in
    847   // the generated TLB file. This is required for ATL to correctly implement the
    848   // corresponding IDispatch interfaces.
    849   interface IGoogleUpdate3;
    850   interface IAppBundle;
    851   interface IApp;
    852   interface IAppCommand;
    853   interface IAppVersion;
    854   interface IPackage;
    855   interface ICurrentState;
    856 
    857   interface IGoogleUpdate3Web;
    858   interface IAppBundleWeb;
    859   interface IAppWeb;
    860   interface IAppCommandWeb;
    861   interface IAppVersionWeb;
    862   interface ICoCreateAsyncStatus;
    863 
    864   [
    865     uuid(022105BD-948A-40c9-AB42-A3300DDF097F),
    866     helpstring("GoogleUpdate3 Class for per-user applications")
    867   ]
    868   coclass GoogleUpdate3UserClass {
    869     [default] interface IDispatch;
    870   }
    871 
    872   [
    873     uuid(4EB61BAC-A3B6-4760-9581-655041EF4D69),
    874     helpstring("GoogleUpdate3 Service Class for machine applications")
    875   ]
    876   coclass GoogleUpdate3ServiceClass {
    877     [default] interface IDispatch;
    878   }
    879 
    880   [
    881     uuid(22181302-A8A6-4f84-A541-E5CBFC70CC43),
    882     helpstring("GoogleUpdate3Web for user applications")
    883   ]
    884   coclass GoogleUpdate3WebUserClass {
    885     [default] interface IDispatch;
    886   }
    887 
    888   [
    889     uuid(8A1D4361-2C08-4700-A351-3EAA9CBFF5E4),
    890     helpstring("Pass-through broker for the GoogleUpdate3WebServiceClass")
    891   ]
    892   coclass GoogleUpdate3WebMachineClass {
    893     [default] interface IDispatch;
    894   }
    895 
    896   [
    897     uuid(534F5323-3569-4f42-919D-1E1CF93E5BF6),
    898     helpstring("GoogleUpdate3Web")
    899   ]
    900   coclass GoogleUpdate3WebServiceClass {
    901     [default] interface IDispatch;
    902   }
    903 
    904   [
    905     uuid(598FE0E5-E02D-465d-9A9D-37974A28FD42),
    906     helpstring("Fallback mechanism if GoogleUpdate3WebServiceClass fails")
    907   ]
    908   coclass GoogleUpdate3WebMachineFallbackClass {
    909     [default] interface IDispatch;
    910   }
    911 
    912   [
    913     uuid(E8CF3E55-F919-49d9-ABC0-948E6CB34B9F),
    914     helpstring("CurrentStateUserClass")
    915   ]
    916   coclass CurrentStateUserClass {
    917     [default] interface ICurrentState;
    918   }
    919 
    920   [
    921     uuid(9D6AA569-9F30-41ad-885A-346685C74928),
    922     helpstring("CurrentStateMachineClass")
    923   ]
    924   coclass CurrentStateMachineClass {
    925     [default] interface ICurrentState;
    926   }
    927 
    928   [
    929     uuid(7DE94008-8AFD-4c70-9728-C6FBFFF6A73E),
    930     helpstring("CoCreateAsyncClass")
    931   ]
    932   coclass CoCreateAsyncClass {
    933     [default] interface IUnknown;
    934   }
    935 
    936   [
    937     uuid(e67be843-bbbe-4484-95fb-05271ae86750),
    938     helpstring("CredentialDialogUserClass")
    939   ]
    940   coclass CredentialDialogUserClass {
    941     [default] interface IUnknown;
    942   }
    943 
    944   [
    945     uuid(25461599-633d-42b1-84fb-7cd68d026e53),
    946     helpstring("CredentialDialogMachineClass")
    947   ]
    948   coclass CredentialDialogMachineClass {
    949     [default] interface IUnknown;
    950   }
    951 
    952   // BEGIN Legacy google_update_idl coclasses.
    953 
    954   [
    955     uuid(ABC01078-F197-4b0b-ADBC-CFE684B39C82),
    956     helpstring("ProcessLauncherClass Class")
    957   ]
    958   coclass ProcessLauncherClass {
    959     [default] interface IUnknown;
    960   }
    961 
    962   [
    963     uuid(51F9E8EF-59D7-475b-A106-C7EA6F30C119),
    964     helpstring("OneClickUserProcessLauncherClass Class")
    965   ]
    966   coclass OneClickUserProcessLauncherClass {
    967     [default] interface IOneClickProcessLauncher;
    968   }
    969 
    970   [
    971     uuid(AAD4AE2E-D834-46d4-8B09-490FAC9C722B),
    972     helpstring("OneClickMachineProcessLauncherClass Class")
    973   ]
    974   coclass OneClickMachineProcessLauncherClass {
    975     [default] interface IOneClickProcessLauncher;
    976   }
    977 
    978   [
    979     uuid(2F0E2680-9FF5-43c0-B76E-114A56E93598),
    980     helpstring("OnDemand updates for per-user applications.")
    981   ]
    982   coclass OnDemandUserAppsClass {
    983     [default] interface IUnknown;
    984   }
    985 
    986   [
    987     uuid(6F8BD55B-E83D-4a47-85BE-81FFA8057A69),
    988     helpstring("OnDemand pass-through broker for machine applications.")
    989   ]
    990   coclass OnDemandMachineAppsClass {
    991     [default] interface IUnknown;
    992   }
    993 
    994   [
    995     uuid(9465B4B4-5216-4042-9A2C-754D3BCDC410),
    996     helpstring("OnDemand updates for per-machine applications.")
    997   ]
    998   coclass OnDemandMachineAppsServiceClass {
    999     [default] interface IUnknown;
   1000   }
   1001 
   1002   [
   1003     uuid(B3D28DBD-0DFA-40e4-8071-520767BADC7E),
   1004     helpstring("Fallback for if OnDemandMachineAppsServiceClass fails.")
   1005   ]
   1006   coclass OnDemandMachineAppsFallbackClass {
   1007     [default] interface IUnknown;
   1008   }
   1009 
   1010   [
   1011     uuid(E225E692-4B47-4777-9BED-4FD7FE257F0E),
   1012     helpstring("GoogleUpdateCore Class")
   1013   ]
   1014   coclass GoogleUpdateCoreClass
   1015   {
   1016     [default] interface IUnknown;
   1017   }
   1018 
   1019   [
   1020     uuid(9B2340A0-4068-43d6-B404-32E27217859D),
   1021     helpstring("GoogleUpdateCore Machine Class")
   1022   ]
   1023   coclass GoogleUpdateCoreMachineClass
   1024   {
   1025     [default] interface IUnknown;
   1026   }
   1027 
   1028   // END Legacy google_update_idl coclasses.
   1029 };
   1030