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

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: More wood behind fewer return statements. 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 "base/win/scoped_com_initializer.h"
12 #include "chrome/browser/extensions/app_host/binaries_installer_internal.h"
13 #include "google_update/google_update_idl.h"
miket_OOO 2012/08/23 23:51:01 Please alphabetize.
erikwright (departed) 2012/08/31 21:04:48 Done.
14
15 using base::win::ScopedBstr;
16 using base::win::ScopedComPtr;
17
18 namespace app_host {
19
20 namespace {
21 const int kInstallationPollingIntervalMs = 50;
22 } // namespace
miket_OOO 2012/08/23 23:51:01 You can leave out the closing comment in short cas
23
24 // Attempts to install the Chrome Binaries using the IGoogleUpdate3 interface.
25 // Blocks until the installation process completes, without message pumping.
26 HRESULT InstallBinaries() {
27 base::win::ScopedCOMInitializer initialize_com;
28
29 HRESULT hr = S_OK;
30 if (!initialize_com.succeeded()) {
31 LOG(ERROR) << "COM initialization failed";
32 hr = E_FAIL;
33 }
miket_OOO 2012/08/23 23:51:01 Since you're not early-returning on failure, I exp
erikwright (departed) 2012/08/31 21:04:48 Other reviewer's (robertshield) preference to mini
34
35 ScopedComPtr<IGoogleUpdate3> update3;
36 if (SUCCEEDED(hr)) {
37 hr = internal::CreateGoogleUpdate3(update3.Receive());
38 }
39
40 ScopedBstr ap_value;
41 if (SUCCEEDED(hr)) {
42 hr = internal::SelectBinariesApValue(update3, ap_value.Receive());
43 }
44
45 ScopedComPtr<IAppBundle> app_bundle;
46 if (SUCCEEDED(hr)) {
47 hr = internal::CreateAppBundle(update3, app_bundle.Receive());
48 }
49
50 ScopedComPtr<IApp> app;
51 if (SUCCEEDED(hr)) {
52 hr = internal::CreateBinariesIApp(app_bundle, ap_value, app.Receive());
53 }
54
55 if (SUCCEEDED(hr)) {
56 hr = app_bundle->checkForUpdate();
57 if (FAILED(hr)) {
58 LOG(ERROR) << "Failed to initiate update check: " << hr;
59 }
60 }
61
62 if (SUCCEEDED(hr)) {
63 while (!internal::CheckIfDone(app_bundle, app, &hr)) {
miket_OOO 2012/08/23 23:51:01 Is this guaranteed to return true eventually? If n
erikwright (departed) 2012/08/31 21:04:48 Yes, the assumption is that Omaha has appropriate
64 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
65 kInstallationPollingIntervalMs));
66 }
67 }
68
69 return hr;
70 }
71
72 } // namespace app_host
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698