Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/extensions/app_host/binaries_installer.cc

Issue 10825364: Upon execution of the App Host, ask Omaha to install the Chrome Binaries if they are not present on… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/app_host/binaries_installer.h"
6
7 #include "base/logging.h"
8 #include "base/threading/platform_thread.h"
9 #include "base/win/scoped_bstr.h"
10 #include "base/win/scoped_comptr.h"
11 #include "chrome/browser/extensions/app_host/binaries_installer_internal.h"
12 #include "google_update/google_update_idl.h"
13
14 using base::win::ScopedBstr;
15 using base::win::ScopedComPtr;
16
17 namespace app_host {
18
19 namespace {
20 const int kInstallationPollingIntervalMs = 50;
21 } // namespace
22
23 // Attempts to install the Chrome Binaries using the IGoogleUpdate3 interface.
24 // Blocks until the installation process completes, without message pumping.
robertshield 2012/08/16 13:08:16 What's the end state of the Omaha registry keys if
erikwright (departed) 2012/08/16 21:05:15 It's presumably the equivalent of a failure after
25 HRESULT InstallBinaries() {
26 HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
robertshield 2012/08/16 13:08:16 Suggest using the stuff in base/win/scoped_com_ini
erikwright (departed) 2012/08/16 21:05:15 I was shocked such a thing didn't exist, but I gue
27 if (FAILED(hr)) {
28 LOG(ERROR) << "CoInitializeEx failed: " << hr;
29 return hr;
30 }
31
32 // After this point, don't return until CoUninitialize is called.
33
34 ScopedComPtr<IGoogleUpdate3> update3;
35 if (SUCCEEDED(hr)) {
36 hr = internal::CreateGoogleUpdate3(update3.Receive());
37 }
38
39 ScopedBstr ap_value;
40 if (SUCCEEDED(hr)) {
41 hr = internal::SelectBinariesApValue(update3, ap_value.Receive());
42 }
43
44 ScopedComPtr<IAppBundle> app_bundle;
45 if (SUCCEEDED(hr)) {
46 hr = internal::CreateAppBundle(update3, app_bundle.Receive());
47 }
48
49 ScopedComPtr<IApp> app;
50 if (SUCCEEDED(hr)) {
51 hr = internal::CreateBinariesIApp(app_bundle, ap_value, app.Receive());
52 }
53
54 if (SUCCEEDED(hr)) {
55 hr = app_bundle->checkForUpdate();
56 if (FAILED(hr)) {
57 LOG(ERROR) << "Failed to initiate update check: " << hr;
58 }
59 }
60
61 if (SUCCEEDED(hr)) {
62 while (!internal::CheckIfDone(app_bundle, app, &hr)) {
63 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
64 kInstallationPollingIntervalMs));
65 }
66 }
67
68 ::CoUninitialize();
69 return hr;
70 }
71
72 } // namespace app_host
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698