| OLD | NEW |
| (Empty) |
| 1 // Copyright 2009 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 #ifndef OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_ | |
| 17 #define OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_ | |
| 18 | |
| 19 #include <atlbase.h> | |
| 20 #include <atlcom.h> | |
| 21 #include <atlctl.h> | |
| 22 | |
| 23 #include "base/basictypes.h" | |
| 24 #include "goopdate/omaha3_idl.h" | |
| 25 #include "omaha/base/atlregmapex.h" | |
| 26 #include "omaha/base/const_addresses.h" | |
| 27 #include "omaha/base/constants.h" | |
| 28 #include "omaha/base/omaha_version.h" | |
| 29 #include "common/goopdate_utils.h" | |
| 30 #include "omaha/plugins/update/config.h" | |
| 31 #include "omaha/plugins/update/resource.h" | |
| 32 #include "omaha/plugins/update/site_lock.h" | |
| 33 #include "plugins/update/activex/update_control_idl.h" | |
| 34 | |
| 35 namespace omaha { | |
| 36 | |
| 37 class Update3WebControl; | |
| 38 | |
| 39 typedef IObjectSafetyImpl<Update3WebControl, INTERFACESAFE_FOR_UNTRUSTED_CALLER> | |
| 40 Update3WebControlSafety; | |
| 41 | |
| 42 class ATL_NO_VTABLE Update3WebControl | |
| 43 : public CComObjectRootEx<CComObjectThreadModel>, | |
| 44 public CComCoClass<Update3WebControl, | |
| 45 &__uuidof(GoogleUpdate3WebControlCoClass)>, | |
| 46 public IDispatchImpl<IGoogleUpdate3WebControl, | |
| 47 &__uuidof(IGoogleUpdate3WebControl), | |
| 48 &LIBID_GoogleUpdateControlLib, 0xffff, 0xffff>, | |
| 49 public Update3WebControlSafety, | |
| 50 public IObjectWithSiteImpl<Update3WebControl> { | |
| 51 public: | |
| 52 Update3WebControl(); | |
| 53 | |
| 54 DECLARE_NOT_AGGREGATABLE(Update3WebControl) | |
| 55 DECLARE_REGISTRY_RESOURCEID_EX(IDR_ONECLICK_RGS) | |
| 56 | |
| 57 #pragma warning(push) | |
| 58 // Construction of local static object is not thread-safe | |
| 59 #pragma warning(disable:4640) | |
| 60 BEGIN_REGISTRY_MAP() | |
| 61 REGMAP_ENTRY(L"CLSID", GetObjectCLSID()) | |
| 62 REGMAP_ENTRY(L"PROGID", kUpdate3WebControlProgId) | |
| 63 REGMAP_ENTRY(L"HKROOT", goopdate_utils::GetHKRoot()) | |
| 64 REGMAP_ENTRY(L"SHELLNAME", is_machine() ? kOmahaBrokerFileName : | |
| 65 kOmahaOnDemandFileName) | |
| 66 REGMAP_ENTRY(L"SHELLPATH", GetShellPathForRegMap()) | |
| 67 // The following entries are actually for the NPAPI plugin | |
| 68 REGMAP_ENTRY(L"PLUGINDESCRIPTION", kAppName) | |
| 69 REGMAP_ENTRY(L"PLUGINDOMAIN", kGoopdateServer) | |
| 70 REGMAP_ENTRY(L"PLUGINVENDOR", kFullCompanyName) | |
| 71 REGMAP_ENTRY(L"PLUGINVERSION", kUpdate3WebPluginVersion) | |
| 72 REGMAP_ENTRY(L"PLUGINPRODUCT", kAppName) | |
| 73 REGMAP_ENTRY(L"PLUGINMIMETYPE", UPDATE3WEB_MIME_TYPE) | |
| 74 END_REGISTRY_MAP() | |
| 75 #pragma warning(pop) | |
| 76 | |
| 77 BEGIN_COM_MAP(Update3WebControl) | |
| 78 COM_INTERFACE_ENTRY(IDispatch) | |
| 79 COM_INTERFACE_ENTRY(IObjectSafety) | |
| 80 COM_INTERFACE_ENTRY(IObjectWithSite) | |
| 81 END_COM_MAP() | |
| 82 | |
| 83 // IGoogleUpdate3WebControl methods. | |
| 84 STDMETHOD(createOmahaMachineServerAsync)(VARIANT_BOOL create_elevated, | |
| 85 IDispatch** async_status); | |
| 86 STDMETHOD(createOmahaUserServer)(IDispatch** server); | |
| 87 | |
| 88 // Gets the version of the passed in application guid. If the application is | |
| 89 // not installed, returns an empty string. | |
| 90 STDMETHOD(getInstalledVersion)(BSTR guid_string, | |
| 91 VARIANT_BOOL is_machine, | |
| 92 BSTR* version_string); | |
| 93 | |
| 94 // OneClick-equivalent API, used for cross-installs. | |
| 95 STDMETHOD(crossInstall)(BSTR extra_args); | |
| 96 | |
| 97 // Launches a command defined by an installed application. Fails if the | |
| 98 // command is not successfully started, succeeds otherwise. Returns without | |
| 99 // waiting for the command to complete. | |
| 100 STDMETHOD(launchAppCommand)(BSTR guid_string, | |
| 101 VARIANT_BOOL is_machine, | |
| 102 BSTR cmd_id); | |
| 103 | |
| 104 protected: | |
| 105 virtual ~Update3WebControl(); | |
| 106 | |
| 107 private: | |
| 108 static bool is_machine() { | |
| 109 return goopdate_utils::IsRunningFromOfficialGoopdateDir(true); | |
| 110 } | |
| 111 | |
| 112 static CString GetShellPathForRegMap() { | |
| 113 return goopdate_utils::BuildInstallDirectory(is_machine(), | |
| 114 GetVersionString()); | |
| 115 } | |
| 116 | |
| 117 HRESULT GetVersionUsingCOMServer(const TCHAR* guid_string, | |
| 118 bool is_machine, | |
| 119 CString* version_string); | |
| 120 HRESULT GetVersionUsingRegistry(const TCHAR* guid_string, | |
| 121 bool is_machine, | |
| 122 CString* version_string); | |
| 123 | |
| 124 SiteLock site_lock_; | |
| 125 | |
| 126 friend class Update3WebControlTest; | |
| 127 | |
| 128 DISALLOW_COPY_AND_ASSIGN(Update3WebControl); | |
| 129 }; | |
| 130 | |
| 131 } // namespace omaha | |
| 132 | |
| 133 #endif // OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_ | |
| OLD | NEW |