OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/win/scoped_comptr.h" | 12 #include "base/win/scoped_comptr.h" |
13 #include "google_update/google_update_idl.h" | 13 #include "google_update/google_update_idl.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class TaskRunner; | 17 class TaskRunner; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 // The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are | 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. | 21 // internal states and will not be reported as results to the listener. |
22 // These values are used for a histogram. Do not reorder. | 22 // These values are used for a histogram. Do not reorder. |
23 enum GoogleUpdateUpgradeResult { | 23 enum GoogleUpdateUpgradeResult { |
Peter Kasting
2015/05/07 01:12:27
Nit: "Status" would be a better word than "Result"
grt (UTC plus 2)
2015/05/08 18:51:50
Indeed. With clients receiving this value during t
| |
24 // The upgrade has started. | 24 // The upgrade has started. |
25 UPGRADE_STARTED = 0, | 25 UPGRADE_STARTED = 0, |
26 // A check for upgrade has been initiated. | 26 // A check for upgrade has been initiated. |
27 UPGRADE_CHECK_STARTED = 1, | 27 UPGRADE_CHECK_STARTED = 1, |
28 // An update is available. | 28 // An update is available (terminal condition when not installing if newer). |
Peter Kasting
2015/05/07 01:12:27
Nit: I'm slightly confused by "when not installing
grt (UTC plus 2)
2015/05/08 18:51:50
All values represent terminal conditions now, so I
| |
29 UPGRADE_IS_AVAILABLE = 2, | 29 UPGRADE_IS_AVAILABLE = 2, |
30 // The upgrade happened successfully. | 30 // The upgrade happened successfully (terminal condition). |
31 UPGRADE_SUCCESSFUL = 3, | 31 UPGRADE_SUCCESSFUL = 3, |
32 // No need to upgrade, Chrome is up to date. | 32 // No need to upgrade, Chrome is up to date (terminal condition). |
33 UPGRADE_ALREADY_UP_TO_DATE = 4, | 33 UPGRADE_ALREADY_UP_TO_DATE = 4, |
34 // An error occurred. | 34 // An error occurred (terminal condition). |
35 UPGRADE_ERROR = 5, | 35 UPGRADE_ERROR = 5, |
36 NUM_UPGRADE_RESULTS | 36 NUM_UPGRADE_RESULTS |
37 }; | 37 }; |
38 | 38 |
39 // These values are used for a histogram. Do not reorder. | 39 // These values are used for a histogram. Do not reorder. |
40 enum GoogleUpdateErrorCode { | 40 enum GoogleUpdateErrorCode { |
41 // The upgrade completed successfully (or hasn't been started yet). | 41 // The upgrade completed successfully (or hasn't been started yet). |
42 GOOGLE_UPDATE_NO_ERROR = 0, | 42 GOOGLE_UPDATE_NO_ERROR = 0, |
43 // Google Update only supports upgrading if Chrome is installed in the default | 43 // Google Update only supports upgrading if Chrome is installed in the default |
44 // location. This error will appear for developer builds and with | 44 // location. This error will appear for developer builds and with |
45 // installations unzipped to random locations. | 45 // installations unzipped to random locations. |
46 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1, | 46 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1, |
47 // Failed to create Google Update JobServer COM class. | 47 // Failed to create Google Update JobServer COM class. DEPRECATED. |
48 GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2, | 48 // GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2, |
49 // Failed to create Google Update OnDemand COM class. | 49 // Failed to create Google Update OnDemand COM class. |
50 GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND = 3, | 50 GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND = 3, |
51 // Google Update OnDemand COM class reported an error during a check for | 51 // Google Update OnDemand COM class reported an error during a check for |
52 // update (or while upgrading). | 52 // update (or while upgrading). |
53 GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR = 4, | 53 GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR = 4, |
54 // A call to GetResults failed. DEPRECATED. | 54 // A call to GetResults failed. DEPRECATED. |
55 // GOOGLE_UPDATE_GET_RESULT_CALL_FAILED = 5, | 55 // GOOGLE_UPDATE_GET_RESULT_CALL_FAILED = 5, |
56 // A call to GetVersionInfo failed. DEPRECATED | 56 // A call to GetVersionInfo failed. DEPRECATED |
57 // GOOGLE_UPDATE_GET_VERSION_INFO_FAILED = 6, | 57 // GOOGLE_UPDATE_GET_VERSION_INFO_FAILED = 6, |
58 // An error occurred while upgrading (or while checking for update). | 58 // An error occurred while upgrading (or while checking for update). |
59 // Check the Google Update log in %TEMP% for more details. | 59 // Check the Google Update log in %TEMP% for more details. |
60 GOOGLE_UPDATE_ERROR_UPDATING = 7, | 60 GOOGLE_UPDATE_ERROR_UPDATING = 7, |
61 // Updates can not be downloaded because the administrator has disabled all | 61 // Updates can not be downloaded because the administrator has disabled all |
62 // types of updating. | 62 // types of updating. |
63 GOOGLE_UPDATE_DISABLED_BY_POLICY = 8, | 63 GOOGLE_UPDATE_DISABLED_BY_POLICY = 8, |
64 // Updates can not be downloaded because the administrator has disabled | 64 // Updates can not be downloaded because the administrator has disabled |
65 // manual (on-demand) updates. Automatic background updates are allowed. | 65 // manual (on-demand) updates. Automatic background updates are allowed. |
66 GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9, | 66 // DEPRECATED. |
67 // GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9, | |
67 NUM_ERROR_CODES | 68 NUM_ERROR_CODES |
68 }; | 69 }; |
69 | 70 |
70 // A callback run when a check for updates has completed. |result| indicates the | 71 // A callback run once or more while an update check is in progress and once |
Peter Kasting
2015/05/07 01:12:27
Nit: "once or more" -> "at least once"?
grt (UTC plus 2)
2015/05/08 18:51:50
Callback removed.
| |
71 // end state of the operation. When |result| is UPGRADE_ERROR, |error_code| and | 72 // when it completes. |result| indicates the current state of the |
72 // |error_message| indicate the the nature of the error. When |result| is | 73 // operation. When |result| is UPGRADE_STARTED, |progress| (a value between 0.0 |
73 // UPGRADE_IS_AVAILABLE or UPGRADE_SUCCESSFUL, |version| may indicate the new | 74 // and 1.0) indicates the progress of the update. |version|, if not empty, |
74 // version Google Update detected (it may, however, be empty). | 75 // indicates the version discovered by Google Update. When |result| is |
76 // UPGRADE_ERROR, |error_code| and |error_message| indicate the the nature of | |
77 // the error. | |
Peter Kasting
2015/05/07 01:12:27
We have several parameters that only have meaning
grt (UTC plus 2)
2015/05/08 18:51:50
That makes sense. I left it as a single callback i
| |
75 typedef base::Callback<void(GoogleUpdateUpgradeResult result, | 78 typedef base::Callback<void(GoogleUpdateUpgradeResult result, |
79 double progress, | |
76 GoogleUpdateErrorCode error_code, | 80 GoogleUpdateErrorCode error_code, |
77 const base::string16& error_message, | 81 const base::string16& error_message, |
78 const base::string16& version)> UpdateCheckCallback; | 82 const base::string16& version)> UpdateCheckCallback; |
79 | 83 |
80 // Begins an asynchronous update check on |task_runner|, which must run a | 84 // 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 | 85 // 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 | 86 // applied. |elevation_window| is the window which should own any necessary |
Peter Kasting
2015/05/07 01:12:28
Nit: "If |install_if_newer| is true, any available
grt (UTC plus 2)
2015/05/08 18:51:50
Done.
| |
83 // elevation UI. |callback| will be run on the caller's thread when the check | 87 // elevation UI. |callback| will be run on the caller's thread to provide status |
84 // completes. | 88 // during the update check and the final results when the check completes. |
85 void BeginUpdateCheck(const scoped_refptr<base::TaskRunner>& task_runner, | 89 void BeginUpdateCheck(const scoped_refptr<base::TaskRunner>& task_runner, |
90 const std::string& locale, | |
86 bool install_if_newer, | 91 bool install_if_newer, |
87 gfx::AcceleratedWidget elevation_window, | 92 gfx::AcceleratedWidget elevation_window, |
88 const UpdateCheckCallback& callback); | 93 const UpdateCheckCallback& callback); |
89 | 94 |
90 // A type of callback supplied by tests to provide a custom IGoogleUpdate | 95 // A type of callback supplied by tests to provide a custom IGoogleUpdate3 |
Peter Kasting
2015/05/07 01:12:27
Nit: Perhaps note where a reader can find out more
grt (UTC plus 2)
2015/05/08 18:51:50
I've put a pointer to the idl. Unfortunately, I wa
| |
91 // implementation. | 96 // implementation. |
92 typedef base::Callback<HRESULT(base::win::ScopedComPtr<IGoogleUpdate>*)> | 97 typedef base::Callback<HRESULT(base::win::ScopedComPtr<IGoogleUpdate3>*)> |
93 OnDemandAppsClassFactory; | 98 GoogleUpdate3ClassFactory; |
94 | 99 |
95 // For use by tests that wish to provide a custom IGoogleUpdate implementation | 100 // For use by tests that wish to provide a custom IGoogleUpdate implementation |
96 // independent of Google Update's. | 101 // independent of Google Update's. |
97 void SetGoogleUpdateFactoryForTesting( | 102 void SetGoogleUpdateFactoryForTesting( |
98 const OnDemandAppsClassFactory& google_update_factory); | 103 const GoogleUpdate3ClassFactory& google_update_factory); |
99 | 104 |
100 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ | 105 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ |
OLD | NEW |