Commit 60254b88 authored by S. Ganesh's avatar S. Ganesh Committed by Commit Bot

Implement a legacy on-demand server for Chrome.

* This is a skeletal implementation of the legacy Omaha3 interfaces as
expected by Chrome's on-demand client.
* All the methods that Chrome calls return S_OK, and unused methods
return E_NOTIMPL.
* When Chrome calls on-demand, we return "noupdate" for now.

Bug: 1067348
Change-Id: I860492c5674a3f20ef74e432d344b065a9056aba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134690Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: S. Ganesh <ganesh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756120}
parent 9e343815
......@@ -13,6 +13,11 @@ midl("updater_idl_idl") {
"UPDATER_LIB_UUID=69464FF0-D9EC-4037-A35F-8AE4358106CC",
"UPDATER_CLSID=158428A4-6014-4978-83BA-9FAD0DABE791",
"UPDATER_SERVICE_UUID=415FD747-D79E-42D7-93AC-1BA6E5FD4E93",
"ICURRENTSTATE_IID=247954F9-9EDC-4E68-8CC3-150C2B89EADF",
"IGOOGLEUPDATE3WEB_IID=494B20CF-282E-4BDD-9F5D-B70CB09D351E",
"IAPPBUNDLEWEB_IID=DD42475D-6D46-496a-924E-BD5630B4CBBA",
"IAPPWEB_IID=18D0F672-18B4-48e6-AD36-6E6BF01DBBC4",
"GOOGLEUPDATE3WEBUSERCLASS_CLSID=22181302-A8A6-4f84-A541-E5CBFC70CC43",
]
writes_tlb = true
......
......@@ -67,8 +67,8 @@ class ComServer : public App {
void FirstTaskRun() override;
// Registers and unregisters the out-of-process COM class factories.
HRESULT RegisterClassObject();
void UnregisterClassObject();
HRESULT RegisterClassObjects();
void UnregisterClassObjects();
// Waits until the last COM object is released.
void WaitForExitSignal();
......@@ -83,7 +83,7 @@ class ComServer : public App {
void Stop();
// Identifier of registered class objects used for unregistration.
DWORD cookies_[1] = {};
DWORD cookies_[2] = {};
// While this object lives, COM can be used by all threads in the program.
base::win::ScopedCOMInitializer com_initializer_;
......@@ -115,7 +115,7 @@ void ComServer::InitializeThreadPool() {
base::ThreadPoolInstance::Get()->Start(init_params);
}
HRESULT ComServer::RegisterClassObject() {
HRESULT ComServer::RegisterClassObjects() {
auto& module = Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::GetModule();
Microsoft::WRL::ComPtr<IUnknown> factory;
......@@ -129,20 +129,38 @@ HRESULT ComServer::RegisterClassObject() {
return hr;
}
Microsoft::WRL::ComPtr<IClassFactory> class_factory;
hr = factory.As(&class_factory);
Microsoft::WRL::ComPtr<IClassFactory> class_factory_updater;
hr = factory.As(&class_factory_updater);
if (FAILED(hr)) {
LOG(ERROR) << "IClassFactory object creation failed; hr: " << hr;
return hr;
}
factory.Reset();
hr = Microsoft::WRL::Details::CreateClassFactory<
Microsoft::WRL::SimpleClassFactory<LegacyOnDemandImpl>>(
&flags, nullptr, __uuidof(IClassFactory), &factory);
if (FAILED(hr)) {
LOG(ERROR) << "Factory creation failed; hr: " << hr;
return hr;
}
Microsoft::WRL::ComPtr<IClassFactory> class_factory_legacy_ondemand;
hr = factory.As(&class_factory_legacy_ondemand);
if (FAILED(hr)) {
LOG(ERROR) << "IClassFactory object creation failed; hr: " << hr;
return hr;
}
// The pointer in this array is unowned. Do not release it.
IClassFactory* class_factories[] = {class_factory.Get()};
IClassFactory* class_factories[] = {class_factory_updater.Get(),
class_factory_legacy_ondemand.Get()};
static_assert(
std::extent<decltype(cookies_)>() == base::size(class_factories),
"Arrays cookies_ and class_factories must be the same size.");
IID class_ids[] = {__uuidof(UpdaterClass)};
IID class_ids[] = {__uuidof(UpdaterClass),
__uuidof(GoogleUpdate3WebUserClass)};
DCHECK_EQ(base::size(cookies_), base::size(class_ids));
static_assert(std::extent<decltype(cookies_)>() == base::size(class_ids),
"Arrays cookies_ and class_ids must be the same size.");
......@@ -157,7 +175,7 @@ HRESULT ComServer::RegisterClassObject() {
return hr;
}
void ComServer::UnregisterClassObject() {
void ComServer::UnregisterClassObjects() {
auto& module = Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::GetModule();
const HRESULT hr =
module.UnregisterCOMObject(nullptr, cookies_, base::size(cookies_));
......@@ -172,7 +190,7 @@ void ComServer::CreateWRLModule() {
void ComServer::Stop() {
VLOG(2) << __func__ << ": COM server is shutting down.";
UnregisterClassObject();
UnregisterClassObjects();
Shutdown(0);
}
......@@ -189,13 +207,205 @@ void ComServer::FirstTaskRun() {
main_task_runner_ = base::SequencedTaskRunnerHandle::Get();
service_ = base::MakeRefCounted<UpdateServiceInProcess>(config_);
CreateWRLModule();
HRESULT hr = RegisterClassObject();
HRESULT hr = RegisterClassObjects();
if (FAILED(hr))
Shutdown(hr);
}
} // namespace
STDMETHODIMP LegacyOnDemandImpl::createAppBundleWeb(
IDispatch** app_bundle_web) {
DCHECK(app_bundle_web);
Microsoft::WRL::ComPtr<IAppBundleWeb> app_bundle(this);
*app_bundle_web = app_bundle.Detach();
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::createApp(BSTR app_id,
BSTR brand_code,
BSTR language,
BSTR ap) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::createInstalledApp(BSTR app_id) {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::createAllInstalledApps() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_displayLanguage(BSTR* language) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::put_displayLanguage(BSTR language) {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::put_parentHWND(ULONG_PTR hwnd) {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::get_length(int* number) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_appWeb(int index, IDispatch** app_web) {
DCHECK(index == 0);
DCHECK(app_web);
Microsoft::WRL::ComPtr<IAppWeb> app(this);
*app_web = app.Detach();
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::initialize() {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::checkForUpdate() {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::download() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::install() {
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::pause() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::resume() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::cancel() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::downloadPackage(BSTR app_id,
BSTR package_name) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_currentState(VARIANT* current_state) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_appId(BSTR* app_id) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_currentVersionWeb(IDispatch** current) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_nextVersionWeb(IDispatch** next) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_command(BSTR command_id,
IDispatch** command) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_currentState(IDispatch** current_state) {
DCHECK(current_state);
Microsoft::WRL::ComPtr<ICurrentState> state(this);
*current_state = state.Detach();
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::launch() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::uninstall() {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_serverInstallDataIndex(BSTR* language) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::put_serverInstallDataIndex(BSTR language) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_stateValue(LONG* state_value) {
DCHECK(state_value);
*state_value = STATE_NO_UPDATE;
return S_OK;
}
STDMETHODIMP LegacyOnDemandImpl::get_availableVersion(BSTR* available_version) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_bytesDownloaded(ULONG* bytes_downloaded) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_totalBytesToDownload(
ULONG* total_bytes_to_download) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_downloadTimeRemainingMs(
LONG* download_time_remaining_ms) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_nextRetryTime(ULONGLONG* next_retry_time) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_installProgress(
LONG* install_progress_percentage) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_installTimeRemainingMs(
LONG* install_time_remaining_ms) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_isCanceled(VARIANT_BOOL* is_canceled) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_errorCode(LONG* error_code) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_extraCode1(LONG* extra_code1) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_completionMessage(
BSTR* completion_message) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_installerResultCode(
LONG* installer_result_code) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_installerResultExtraCode1(
LONG* installer_result_extra_code1) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_postInstallLaunchCommandLine(
BSTR* post_install_launch_command_line) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_postInstallUrl(BSTR* post_install_url) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::get_postInstallAction(
LONG* post_install_action) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::GetTypeInfoCount(UINT*) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::GetTypeInfo(UINT, LCID, ITypeInfo**) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::GetIDsOfNames(REFIID,
LPOLESTR*,
UINT,
LCID,
DISPID*) {
return E_NOTIMPL;
}
STDMETHODIMP LegacyOnDemandImpl::Invoke(DISPID,
REFIID,
LCID,
WORD,
DISPPARAMS*,
VARIANT*,
EXCEPINFO*,
UINT*) {
return E_NOTIMPL;
}
STDMETHODIMP CompleteStatusImpl::get_statusCode(LONG* code) {
DCHECK(code);
......
......@@ -19,6 +19,99 @@ namespace updater {
// duplication for the registration and unregistration code in both server and
// service_main compilation units.
//
// This class implements the legacy Omaha3 interfaces as expected by Chrome's
// on-demand client.
class LegacyOnDemandImpl
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
IGoogleUpdate3Web,
IAppBundleWeb,
IAppWeb,
ICurrentState,
IDispatch> {
public:
LegacyOnDemandImpl() = default;
LegacyOnDemandImpl(const LegacyOnDemandImpl&) = delete;
LegacyOnDemandImpl& operator=(const LegacyOnDemandImpl&) = delete;
// Overrides for IGoogleUpdate3Web.
IFACEMETHODIMP createAppBundleWeb(IDispatch** app_bundle_web) override;
// Overrides for IAppBundleWeb.
IFACEMETHODIMP createApp(BSTR app_id,
BSTR brand_code,
BSTR language,
BSTR ap) override;
IFACEMETHODIMP createInstalledApp(BSTR app_id) override;
IFACEMETHODIMP createAllInstalledApps() override;
IFACEMETHODIMP get_displayLanguage(BSTR* language) override;
IFACEMETHODIMP put_displayLanguage(BSTR language) override;
IFACEMETHODIMP put_parentHWND(ULONG_PTR hwnd) override;
IFACEMETHODIMP get_length(int* number) override;
IFACEMETHODIMP get_appWeb(int index, IDispatch** app_web) override;
IFACEMETHODIMP initialize() override;
IFACEMETHODIMP checkForUpdate() override;
IFACEMETHODIMP download() override;
IFACEMETHODIMP install() override;
IFACEMETHODIMP pause() override;
IFACEMETHODIMP resume() override;
IFACEMETHODIMP cancel() override;
IFACEMETHODIMP downloadPackage(BSTR app_id, BSTR package_name) override;
IFACEMETHODIMP get_currentState(VARIANT* current_state) override;
// Overrides for IAppWeb.
IFACEMETHODIMP get_appId(BSTR* app_id) override;
IFACEMETHODIMP get_currentVersionWeb(IDispatch** current) override;
IFACEMETHODIMP get_nextVersionWeb(IDispatch** next) override;
IFACEMETHODIMP get_command(BSTR command_id, IDispatch** command) override;
IFACEMETHODIMP get_currentState(IDispatch** current_state) override;
IFACEMETHODIMP launch() override;
IFACEMETHODIMP uninstall() override;
IFACEMETHODIMP get_serverInstallDataIndex(BSTR* language) override;
IFACEMETHODIMP put_serverInstallDataIndex(BSTR language) override;
// Overrides for ICurrentState.
IFACEMETHODIMP get_stateValue(LONG* state_value) override;
IFACEMETHODIMP get_availableVersion(BSTR* available_version) override;
IFACEMETHODIMP get_bytesDownloaded(ULONG* bytes_downloaded) override;
IFACEMETHODIMP get_totalBytesToDownload(
ULONG* total_bytes_to_download) override;
IFACEMETHODIMP get_downloadTimeRemainingMs(
LONG* download_time_remaining_ms) override;
IFACEMETHODIMP get_nextRetryTime(ULONGLONG* next_retry_time) override;
IFACEMETHODIMP get_installProgress(
LONG* install_progress_percentage) override;
IFACEMETHODIMP get_installTimeRemainingMs(
LONG* install_time_remaining_ms) override;
IFACEMETHODIMP get_isCanceled(VARIANT_BOOL* is_canceled) override;
IFACEMETHODIMP get_errorCode(LONG* error_code) override;
IFACEMETHODIMP get_extraCode1(LONG* extra_code1) override;
IFACEMETHODIMP get_completionMessage(BSTR* completion_message) override;
IFACEMETHODIMP get_installerResultCode(LONG* installer_result_code) override;
IFACEMETHODIMP get_installerResultExtraCode1(
LONG* installer_result_extra_code1) override;
IFACEMETHODIMP get_postInstallLaunchCommandLine(
BSTR* post_install_launch_command_line) override;
IFACEMETHODIMP get_postInstallUrl(BSTR* post_install_url) override;
IFACEMETHODIMP get_postInstallAction(LONG* post_install_action) override;
// Overrides for IDispatch.
IFACEMETHODIMP GetTypeInfoCount(UINT*) override;
IFACEMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo**) override;
IFACEMETHODIMP GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*) override;
IFACEMETHODIMP Invoke(DISPID,
REFIID,
LCID,
WORD,
DISPPARAMS*,
VARIANT*,
EXCEPINFO*,
UINT*) override;
private:
~LegacyOnDemandImpl() override = default;
};
// This class implements the ICompleteStatus interface and exposes it as a COM
// object.
class CompleteStatusImpl
......
......@@ -5,6 +5,210 @@
import "oaidl.idl";
import "ocidl.idl";
// The following are copied from omaha3_idl.idl:
// enum CurrentState.
// interface ICurrentState.
// interface IGoogleUpdate3Web.
// interface IAppBundleWeb.
// interface IAppWeb.
// coclass GoogleUpdate3WebUserClass.
// The normal install flow proceeds from STATE_INIT through
// STATE_INSTALL_COMPLETE in order, skipping states that are not relevant.
// All exceptions and terminal states are start with STATE_INSTALL_COMPLETE.
typedef enum CurrentState {
STATE_INIT = 1,
STATE_WAITING_TO_CHECK_FOR_UPDATE = 2,
STATE_CHECKING_FOR_UPDATE = 3,
STATE_UPDATE_AVAILABLE = 4,
STATE_WAITING_TO_DOWNLOAD = 5,
STATE_RETRYING_DOWNLOAD = 6,
STATE_DOWNLOADING = 7,
STATE_DOWNLOAD_COMPLETE = 8,
STATE_EXTRACTING = 9,
STATE_APPLYING_DIFFERENTIAL_PATCH = 10,
// TODO(omaha3): Should we move STATE_DOWNLOAD_COMPLETE here and eliminate
// STATE_READY_TO_INSTALL?
STATE_READY_TO_INSTALL = 11,
STATE_WAITING_TO_INSTALL = 12,
STATE_INSTALLING = 13,
STATE_INSTALL_COMPLETE = 14,
STATE_PAUSED = 15,
STATE_NO_UPDATE = 16,
STATE_ERROR = 17,
} CurrentState;
[
object,
dual,
uuid(ICURRENTSTATE_IID),
helpstring("ICurrentState Interface"),
pointer_default(unique)
]
interface ICurrentState : IDispatch {
// This interface is exposed to web clients!
// TODO(omaha3): Update valid comments once we settle on an implementation.
// A value from the CurrentState enum. This value determines which of the
// properties below are valid.
[propget] HRESULT stateValue([out, retval] LONG*);
// The remaining properties are only valid in the specified states. For all
// other states, the values are not specified.
// This property is valid only when stateValue is STATE_UPDATE_AVAILABLE.
[propget] HRESULT availableVersion([out, retval] BSTR*);
// The following three properties are only valid when stateValue is
// STATE_WAITING_TO_DOWNLOAD, STATE_RETRYING_DOWNLOAD, STATE_DOWNLOADING,
// STATE_DOWNLOAD_COMPLETE, STATE_EXTRACTING,
// STATE_APPLYING_DIFFERENTIAL_PATCH, or STATE_READY_TO_INSTALL.
// Bytes downloaded so far.
[propget] HRESULT bytesDownloaded([out, retval] ULONG*);
// Total bytes to download.
[propget] HRESULT totalBytesToDownload([out, retval] ULONG*);
// Estimated download time remaining in ms. -1 indicates unknown.
// Progress may not always be available, so clients should handle the -1 case.
[propget] HRESULT downloadTimeRemainingMs([out, retval] LONG*);
[propget] HRESULT nextRetryTime([out, retval] ULONGLONG*);
// TODO(omaha 3): Need some way to indicate reconnecting, retrying, etc.
// The following two properties are only valid when stateValue is
// STATE_INSTALLING or STATE_INSTALL_COMPLETE.
// Current install progress in percentage from 0 to 100. -1 indicates unknown.
// Progress may not always be available, so clients should handle the -1 case.
[propget] HRESULT installProgress([out, retval] LONG*);
// Estimated download time remaining in ms. -1 indicates unknown.
// Progress may not always be available, so clients should handle the -1 case.
[propget] HRESULT installTimeRemainingMs([out, retval] LONG*);
// The following four properties are only valid when stateValue is
// STATE_ERROR:
// Returns true if the app has been canceled.
[propget] HRESULT isCanceled([out, retval] VARIANT_BOOL* is_canceled);
// Error code.
[propget] HRESULT errorCode([out, retval] LONG*);
// Error extra code.
[propget] HRESULT extraCode1([out, retval] LONG*);
// The following three properties are only valid when stateValue is
// STATE_ERROR or STATE_INSTALL_COMPLETE.
// TODO(omaha3): If STATE_DOWNLOAD_COMPLETE or STATE_READY_TO_INSTALL becomes
// a terminal state, does it support completion messages?
// Completion message, localized in the specified language.
// TODO(omaha3): If we're going to have bundle error messages too, should the
// language be at bundle level? Should bundle have its own language setter?
[propget] HRESULT completionMessage([out, retval] BSTR*);
// Application installer result code. This is to be used as additional
// information only. Success/failure should be determined using errorCode.
// This is an error if errorCode is GOOPDATEINSTALL_E_INSTALLER_FAILED.
[propget] HRESULT installerResultCode([out, retval] LONG*);
// Application installer extra code.
[propget] HRESULT installerResultExtraCode1([out, retval] LONG*);
// A command that needs to be launched by the client after installation.
[propget] HRESULT postInstallLaunchCommandLine([out, retval] BSTR*);
// URL to be launched after restarting the browser.
[propget] HRESULT postInstallUrl([out, retval] BSTR*);
// Returns a PostInstallAction value indicating the action to be taken by the
// client after installation.
[propget] HRESULT postInstallAction([out, retval] LONG*);
}
[
object,
dual,
uuid(IGOOGLEUPDATE3WEB_IID),
helpstring("IGoogleUpdate3Web Interface"),
pointer_default(unique)
]
interface IGoogleUpdate3Web : IDispatch {
HRESULT createAppBundleWeb([out, retval] IDispatch** app_bundle_web);
};
[
object,
dual,
uuid(IAPPBUNDLEWEB_IID),
helpstring("IAppBundleWeb Interface"),
pointer_default(unique)
]
interface IAppBundleWeb : IDispatch {
[id(2)] HRESULT createApp([in] BSTR app_guid,
[in] BSTR brand_code,
[in] BSTR language,
[in] BSTR ap);
[id(3)] HRESULT createInstalledApp([in] BSTR app_id);
[id(4)] HRESULT createAllInstalledApps();
[propget] HRESULT displayLanguage([out, retval] BSTR*);
[propput] HRESULT displayLanguage([in] BSTR);
[propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
[propget] HRESULT length([out, retval] int* index);
[id(DISPID_VALUE), propget] HRESULT appWeb(
[in] int index, [out, retval] IDispatch** app_web);
HRESULT initialize();
HRESULT checkForUpdate();
HRESULT download();
HRESULT install();
HRESULT pause();
HRESULT resume();
HRESULT cancel();
HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
[propget] HRESULT currentState([out, retval] VARIANT* current_state);
};
[
object,
dual,
uuid(IAPPWEB_IID),
helpstring("IAppWeb Interface"),
pointer_default(unique)
]
interface IAppWeb : IDispatch {
[propget] HRESULT appId([out, retval] BSTR*);
// Returns an IAppVersionWeb IDispatch object.
[propget] HRESULT currentVersionWeb([out, retval] IDispatch** current);
[propget] HRESULT nextVersionWeb([out, retval] IDispatch** next);
// Returns an IAppCommandWeb IDispatch object, or NULL.
[propget] HRESULT command([in] BSTR command_id,
[out, retval] IDispatch** command);
HRESULT cancel();
[propget] HRESULT currentState([out, retval] IDispatch** current_state);
HRESULT launch();
HRESULT uninstall();
[propget] HRESULT serverInstallDataIndex([out, retval] BSTR*);
[propput] HRESULT serverInstallDataIndex([in] BSTR);
};
[
object,
dual,
......@@ -56,6 +260,11 @@ library UpdaterLib {
interface IUpdater;
interface ICurrentState;
interface IGoogleUpdate3Web;
interface IAppBundleWeb;
interface IAppWeb;
[
uuid(UPDATER_CLSID),
helpstring("Updater Class")
......@@ -74,4 +283,12 @@ library UpdaterLib {
[default] interface IUnknown;
}
[
uuid(GOOGLEUPDATE3WEBUSERCLASS_CLSID),
helpstring("GoogleUpdate3Web for user applications")
]
coclass GoogleUpdate3WebUserClass {
[default] interface IDispatch;
}
};
......@@ -68,31 +68,35 @@ void AddComServerWorkItems(HKEY root,
return;
}
const base::string16 clsid_reg_path = GetComServerClsidRegistryPath();
for (const auto& clsid :
{__uuidof(UpdaterClass), __uuidof(GoogleUpdate3WebUserClass)}) {
const base::string16 clsid_reg_path = GetComServerClsidRegistryPath(clsid);
// Delete any old registrations first.
for (const auto& reg_path : {clsid_reg_path}) {
for (const auto& key_flag : {KEY_WOW64_32KEY, KEY_WOW64_64KEY})
list->AddDeleteRegKeyWorkItem(root, reg_path, key_flag);
}
// Delete any old registrations first.
for (const auto& reg_path : {clsid_reg_path}) {
for (const auto& key_flag : {KEY_WOW64_32KEY, KEY_WOW64_64KEY})
list->AddDeleteRegKeyWorkItem(root, reg_path, key_flag);
}
list->AddCreateRegKeyWorkItem(root, clsid_reg_path, WorkItem::kWow64Default);
const base::string16 local_server32_reg_path =
base::StrCat({clsid_reg_path, L"\\LocalServer32"});
list->AddCreateRegKeyWorkItem(root, local_server32_reg_path,
WorkItem::kWow64Default);
list->AddCreateRegKeyWorkItem(root, clsid_reg_path,
WorkItem::kWow64Default);
const base::string16 local_server32_reg_path =
base::StrCat({clsid_reg_path, L"\\LocalServer32"});
list->AddCreateRegKeyWorkItem(root, local_server32_reg_path,
WorkItem::kWow64Default);
base::CommandLine run_com_server_command(com_server_path);
run_com_server_command.AppendSwitch(kServerSwitch);
base::CommandLine run_com_server_command(com_server_path);
run_com_server_command.AppendSwitch(kServerSwitch);
#if !defined(NDEBUG)
run_com_server_command.AppendSwitch(kEnableLoggingSwitch);
run_com_server_command.AppendSwitchASCII(kLoggingModuleSwitch,
"*/chrome/updater/*=2");
run_com_server_command.AppendSwitch(kEnableLoggingSwitch);
run_com_server_command.AppendSwitchASCII(kLoggingModuleSwitch,
"*/chrome/updater/*=2");
#endif
list->AddSetRegValueWorkItem(
root, local_server32_reg_path, WorkItem::kWow64Default, L"",
run_com_server_command.GetCommandLineString(), true);
list->AddSetRegValueWorkItem(
root, local_server32_reg_path, WorkItem::kWow64Default, L"",
run_com_server_command.GetCommandLineString(), true);
}
}
// Adds work items to register the COM Service with Windows.
......@@ -138,8 +142,10 @@ void AddComInterfacesWorkItems(HKEY root,
return;
}
for (const auto iid : {__uuidof(IUpdater), __uuidof(IUpdaterObserver),
__uuidof(ICompleteStatus)}) {
for (const auto& iid :
{__uuidof(IUpdater), __uuidof(IUpdaterObserver),
__uuidof(ICompleteStatus), __uuidof(IGoogleUpdate3Web),
__uuidof(IAppBundleWeb), __uuidof(IAppWeb), __uuidof(ICurrentState)}) {
const base::string16 iid_reg_path = GetComIidRegistryPath(iid);
const base::string16 typelib_reg_path = GetComTypeLibRegistryPath(iid);
......
......@@ -39,12 +39,9 @@ void UnregisterUpdateAppsTask() {
task_scheduler->DeleteTask(kTaskName);
}
base::string16 GetComServerClsid() {
return base::win::String16FromGUID(__uuidof(UpdaterClass));
}
base::string16 GetComServerClsidRegistryPath() {
return base::StrCat({L"Software\\Classes\\CLSID\\", GetComServerClsid()});
base::string16 GetComServerClsidRegistryPath(REFCLSID clsid) {
return base::StrCat(
{L"Software\\Classes\\CLSID\\", base::win::String16FromGUID(clsid)});
}
base::string16 GetComServiceClsid() {
......
......@@ -19,8 +19,7 @@ namespace updater {
bool RegisterUpdateAppsTask(const base::CommandLine& run_command);
void UnregisterUpdateAppsTask();
base::string16 GetComServerClsid();
base::string16 GetComServerClsidRegistryPath();
base::string16 GetComServerClsidRegistryPath(REFCLSID clsid);
base::string16 GetComServiceClsid();
base::string16 GetComServiceClsidRegistryPath();
base::string16 GetComServiceAppidRegistryPath();
......
......@@ -32,8 +32,11 @@
namespace updater {
void DeleteComServer(HKEY root) {
InstallUtil::DeleteRegistryKey(root, GetComServerClsidRegistryPath(),
WorkItem::kWow64Default);
for (const auto& clsid :
{__uuidof(UpdaterClass), __uuidof(GoogleUpdate3WebUserClass)}) {
InstallUtil::DeleteRegistryKey(root, GetComServerClsidRegistryPath(clsid),
WorkItem::kWow64Default);
}
}
void DeleteComService() {
......@@ -50,8 +53,10 @@ void DeleteComService() {
}
void DeleteComInterfaces(HKEY root) {
for (const auto iid : {__uuidof(IUpdater), __uuidof(IUpdaterObserver),
__uuidof(ICompleteStatus)}) {
for (const auto& iid :
{__uuidof(IUpdater), __uuidof(IUpdaterObserver),
__uuidof(ICompleteStatus), __uuidof(IGoogleUpdate3Web),
__uuidof(IAppBundleWeb), __uuidof(IAppWeb), __uuidof(ICurrentState)}) {
for (const auto& reg_path :
{GetComIidRegistryPath(iid), GetComTypeLibRegistryPath(iid)}) {
InstallUtil::DeleteRegistryKey(root, reg_path, WorkItem::kWow64Default);
......
......@@ -11,6 +11,7 @@
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
......
......@@ -67,6 +67,18 @@ typedef IID CLSID;
#endif // !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_ICurrentState,0x247954F9,0x9EDC,0x4E68,0x8C,0xC3,0x15,0x0C,0x2B,0x89,0xEA,0xDF);
MIDL_DEFINE_GUID(IID, IID_IGoogleUpdate3Web,0x494B20CF,0x282E,0x4BDD,0x9F,0x5D,0xB7,0x0C,0xB0,0x9D,0x35,0x1E);
MIDL_DEFINE_GUID(IID, IID_IAppBundleWeb,0xDD42475D,0x6D46,0x496a,0x92,0x4E,0xBD,0x56,0x30,0xB4,0xCB,0xBA);
MIDL_DEFINE_GUID(IID, IID_IAppWeb,0x18D0F672,0x18B4,0x48e6,0xAD,0x36,0x6E,0x6B,0xF0,0x1D,0xBB,0xC4);
MIDL_DEFINE_GUID(IID, IID_ICompleteStatus,0x2FCD14AF,0xB645,0x4351,0x83,0x59,0xE8,0x0A,0x0E,0x20,0x2A,0x0B);
......@@ -84,6 +96,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterClass,0x158428A4,0x6014,0x4978,0x83,0xBA,0x
MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterServiceClass,0x415FD747,0xD79E,0x42D7,0x93,0xAC,0x1B,0xA6,0xE5,0xFD,0x4E,0x93);
MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebUserClass,0x22181302,0xA8A6,0x4f84,0xA5,0x41,0xE5,0xCB,0xFC,0x70,0xCC,0x43);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
......
......@@ -11,6 +11,7 @@
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
......
......@@ -67,6 +67,18 @@ typedef IID CLSID;
#endif // !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_ICurrentState,0x247954F9,0x9EDC,0x4E68,0x8C,0xC3,0x15,0x0C,0x2B,0x89,0xEA,0xDF);
MIDL_DEFINE_GUID(IID, IID_IGoogleUpdate3Web,0x494B20CF,0x282E,0x4BDD,0x9F,0x5D,0xB7,0x0C,0xB0,0x9D,0x35,0x1E);
MIDL_DEFINE_GUID(IID, IID_IAppBundleWeb,0xDD42475D,0x6D46,0x496a,0x92,0x4E,0xBD,0x56,0x30,0xB4,0xCB,0xBA);
MIDL_DEFINE_GUID(IID, IID_IAppWeb,0x18D0F672,0x18B4,0x48e6,0xAD,0x36,0x6E,0x6B,0xF0,0x1D,0xBB,0xC4);
MIDL_DEFINE_GUID(IID, IID_ICompleteStatus,0x2FCD14AF,0xB645,0x4351,0x83,0x59,0xE8,0x0A,0x0E,0x20,0x2A,0x0B);
......@@ -84,6 +96,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterClass,0x158428A4,0x6014,0x4978,0x83,0xBA,0x
MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterServiceClass,0x415FD747,0xD79E,0x42D7,0x93,0xAC,0x1B,0xA6,0xE5,0xFD,0x4E,0x93);
MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebUserClass,0x22181302,0xA8A6,0x4f84,0xA5,0x41,0xE5,0xCB,0xFC,0x70,0xCC,0x43);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
......
......@@ -11,6 +11,7 @@
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
......
......@@ -67,6 +67,18 @@ typedef IID CLSID;
#endif // !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_ICurrentState,0x247954F9,0x9EDC,0x4E68,0x8C,0xC3,0x15,0x0C,0x2B,0x89,0xEA,0xDF);
MIDL_DEFINE_GUID(IID, IID_IGoogleUpdate3Web,0x494B20CF,0x282E,0x4BDD,0x9F,0x5D,0xB7,0x0C,0xB0,0x9D,0x35,0x1E);
MIDL_DEFINE_GUID(IID, IID_IAppBundleWeb,0xDD42475D,0x6D46,0x496a,0x92,0x4E,0xBD,0x56,0x30,0xB4,0xCB,0xBA);
MIDL_DEFINE_GUID(IID, IID_IAppWeb,0x18D0F672,0x18B4,0x48e6,0xAD,0x36,0x6E,0x6B,0xF0,0x1D,0xBB,0xC4);
MIDL_DEFINE_GUID(IID, IID_ICompleteStatus,0x2FCD14AF,0xB645,0x4351,0x83,0x59,0xE8,0x0A,0x0E,0x20,0x2A,0x0B);
......@@ -84,6 +96,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterClass,0x158428A4,0x6014,0x4978,0x83,0xBA,0x
MIDL_DEFINE_GUID(CLSID, CLSID_UpdaterServiceClass,0x415FD747,0xD79E,0x42D7,0x93,0xAC,0x1B,0xA6,0xE5,0xFD,0x4E,0x93);
MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebUserClass,0x22181302,0xA8A6,0x4f84,0xA5,0x41,0xE5,0xCB,0xFC,0x70,0xCC,0x43);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment