Re-enable child account detection, now behind a flag.
[chromium-blink-merge.git] / chrome / browser / google / google_update_win.h
blob75119e841281b836a81f55f1ea6ad5e7b4cb6165
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.
5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/strings/string16.h"
12 #include "base/win/scoped_comptr.h"
13 #include "google_update/google_update_idl.h"
14 #include "ui/gfx/native_widget_types.h"
16 namespace base {
17 class TaskRunner;
18 } // namespace base
20 // The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are
21 // internal states and will not be reported as results to the listener.
22 // These values are used for a histogram. Do not reorder.
23 enum GoogleUpdateUpgradeResult {
24 // The upgrade has started.
25 UPGRADE_STARTED = 0,
26 // A check for upgrade has been initiated.
27 UPGRADE_CHECK_STARTED = 1,
28 // An update is available.
29 UPGRADE_IS_AVAILABLE = 2,
30 // The upgrade happened successfully.
31 UPGRADE_SUCCESSFUL = 3,
32 // No need to upgrade, Chrome is up to date.
33 UPGRADE_ALREADY_UP_TO_DATE = 4,
34 // An error occurred.
35 UPGRADE_ERROR = 5,
36 NUM_UPGRADE_RESULTS
39 // These values are used for a histogram. Do not reorder.
40 enum GoogleUpdateErrorCode {
41 // The upgrade completed successfully (or hasn't been started yet).
42 GOOGLE_UPDATE_NO_ERROR = 0,
43 // Google Update only supports upgrading if Chrome is installed in the default
44 // location. This error will appear for developer builds and with
45 // installations unzipped to random locations.
46 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1,
47 // Failed to create Google Update JobServer COM class.
48 GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2,
49 // Failed to create Google Update OnDemand COM class.
50 GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND = 3,
51 // Google Update OnDemand COM class reported an error during a check for
52 // update (or while upgrading).
53 GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR = 4,
54 // A call to GetResults failed. DEPRECATED.
55 // GOOGLE_UPDATE_GET_RESULT_CALL_FAILED = 5,
56 // A call to GetVersionInfo failed. DEPRECATED
57 // GOOGLE_UPDATE_GET_VERSION_INFO_FAILED = 6,
58 // An error occurred while upgrading (or while checking for update).
59 // Check the Google Update log in %TEMP% for more details.
60 GOOGLE_UPDATE_ERROR_UPDATING = 7,
61 // Updates can not be downloaded because the administrator has disabled all
62 // types of updating.
63 GOOGLE_UPDATE_DISABLED_BY_POLICY = 8,
64 // Updates can not be downloaded because the administrator has disabled
65 // manual (on-demand) updates. Automatic background updates are allowed.
66 GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9,
67 NUM_ERROR_CODES
70 // A callback run when a check for updates has completed. |result| indicates the
71 // end state of the operation. When |result| is UPGRADE_ERROR, |error_code| and
72 // |error_message| indicate the the nature of the error. When |result| is
73 // UPGRADE_IS_AVAILABLE or UPGRADE_SUCCESSFUL, |version| may indicate the new
74 // version Google Update detected (it may, however, be empty).
75 typedef base::Callback<void(GoogleUpdateUpgradeResult result,
76 GoogleUpdateErrorCode error_code,
77 const base::string16& error_message,
78 const base::string16& version)> UpdateCheckCallback;
80 // Begins an asynchronous update check on |task_runner|, which must run a
81 // TYPE_UI message loop. If |install_if_newer| is true, an update will be
82 // applied. |elevation_window| is the window which should own any necessary
83 // elevation UI. |callback| will be run on the caller's thread when the check
84 // completes.
85 void BeginUpdateCheck(const scoped_refptr<base::TaskRunner>& task_runner,
86 bool install_if_newer,
87 gfx::AcceleratedWidget elevation_window,
88 const UpdateCheckCallback& callback);
90 // A type of callback supplied by tests to provide a custom IGoogleUpdate
91 // implementation.
92 typedef base::Callback<HRESULT(base::win::ScopedComPtr<IGoogleUpdate>*)>
93 OnDemandAppsClassFactory;
95 // For use by tests that wish to provide a custom IGoogleUpdate implementation
96 // independent of Google Update's.
97 void SetGoogleUpdateFactoryForTesting(
98 const OnDemandAppsClassFactory& google_update_factory);
100 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_