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

Side by Side Diff: chrome/browser/google/google_update.h

Issue 10698106: Switch about box to web ui on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: With GoogleUpdate on Windows only. Created 8 years, 5 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 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/string16.h"
12 #if defined(OS_WIN)
13 #include "google_update/google_update_idl.h"
14 #endif
15
16 class MessageLoop;
17 namespace views {
18 class Widget;
19 }
20
21 // The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are
22 // internal states and will not be reported as results to the listener.
23 enum GoogleUpdateUpgradeResult {
24 // The upgrade has started.
25 UPGRADE_STARTED = 0,
26 // A check for upgrade has been initiated.
27 UPGRADE_CHECK_STARTED,
28 // An update is available.
29 UPGRADE_IS_AVAILABLE,
30 // The upgrade happened successfully.
31 UPGRADE_SUCCESSFUL,
32 // No need to upgrade, we are up to date.
33 UPGRADE_ALREADY_UP_TO_DATE,
34 // An error occurred.
35 UPGRADE_ERROR,
36 };
37
38 enum GoogleUpdateErrorCode {
39 // The upgrade completed successfully (or hasn't been started yet).
40 GOOGLE_UPDATE_NO_ERROR = 0,
41 // Google Update only supports upgrading if Chrome is installed in the default
42 // location. This error will appear for developer builds and with
43 // installations unzipped to random locations.
44 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY,
45 // Failed to create Google Update JobServer COM class.
46 GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED,
47 // Failed to create Google Update OnDemand COM class.
48 GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND,
49 // Google Update OnDemand COM class reported an error during a check for
50 // update (or while upgrading).
51 GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR,
52 // A call to GetResults failed.
53 GOOGLE_UPDATE_GET_RESULT_CALL_FAILED,
54 // A call to GetVersionInfo failed.
55 GOOGLE_UPDATE_GET_VERSION_INFO_FAILED,
56 // An error occurred while upgrading (or while checking for update).
57 // Check the Google Update log in %TEMP% for more details.
58 GOOGLE_UPDATE_ERROR_UPDATING,
59 // Updates can not be downloaded because the administrator has disabled them.
60 GOOGLE_UPDATE_DISABLED_BY_POLICY,
61 };
62
63 // The GoogleUpdateStatusListener interface is used by components to receive
64 // notifications about the results of an Google Update operation.
65 class GoogleUpdateStatusListener {
66 public:
67 // This function is called when Google Update has finished its operation and
68 // wants to notify us about the results. |results| represents what the end
69 // state is, |error_code| represents what error occurred, |error_message| is a
70 // string version of the same (might be blank) and |version| specifies what
71 // new version Google Update detected (or installed). This value can be a
72 // blank string, if the version tag in the Update{} block (in Google Update's
73 // server config for Chrome) is blank.
74 virtual void OnReportResults(GoogleUpdateUpgradeResult results,
75 GoogleUpdateErrorCode error_code,
76 const string16& error_message,
77 const string16& version) = 0;
78 };
79
80 ////////////////////////////////////////////////////////////////////////////////
81 //
82 // The Google Update class is responsible for communicating with Google Update
83 // and get it to perform operations on our behalf (for example, CheckForUpdate).
84 // This class will report back to its parent via the GoogleUpdateStatusListener
85 // interface and will delete itself after reporting back.
86 //
87 ////////////////////////////////////////////////////////////////////////////////
88 class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> {
89 public:
90 GoogleUpdate();
91
92 // Ask Google Update to see if a new version is available. If the parameter
93 // |install_if_newer| is true then Google Update will also install that new
94 // version.
95 // |window| should point to a foreground window. This is needed to ensure
96 // that Vista/Windows 7 UAC prompts show up in the foreground. It may also
97 // be null.
98 void CheckForUpdate(bool install_if_newer, views::Widget* window);
99
100 // Pass NULL to clear the listener
101 void set_status_listener(GoogleUpdateStatusListener* listener) {
102 listener_ = listener;
103 }
104
105 private:
106 friend class base::RefCountedThreadSafe<GoogleUpdate>;
107
108 virtual ~GoogleUpdate();
109
110 // The chromeos implementation is in browser/chromeos/google_update.cpp
111
112 #if defined(OS_WIN)
113
114 // This function reports failure from the Google Update operation to the
115 // listener.
116 // Note, after this function completes, this object will have deleted itself.
117 bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code,
118 const string16& error_message, MessageLoop* main_loop);
119
120 #endif
121
122 // We need to run the update check on another thread than the main thread, and
123 // therefore CheckForUpdate will delegate to this function. |main_loop| points
124 // to the message loop that we want the response to come from.
125 // |window| should point to a foreground window. This is needed to ensure that
126 // Vista/Windows 7 UAC prompts show up in the foreground. It may also be null.
127 void InitiateGoogleUpdateCheck(bool install_if_newer, views::Widget* window,
128 MessageLoop* main_loop);
129
130 // This function reports the results of the GoogleUpdate operation to the
131 // listener. If results indicates an error, the |error_code| and
132 // |error_message| will indicate which error occurred.
133 // Note, after this function completes, this object will have deleted itself.
134 void ReportResults(GoogleUpdateUpgradeResult results,
135 GoogleUpdateErrorCode error_code,
136 const string16& error_message);
137
138 // Which version string Google Update found (if a new one was available).
139 // Otherwise, this will be blank.
140 string16 version_available_;
141
142 // The listener who is interested in finding out the result of the operation.
143 GoogleUpdateStatusListener* listener_;
144
145 DISALLOW_COPY_AND_ASSIGN(GoogleUpdate);
146 };
147
148 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google/google_update.cc » ('j') | chrome/browser/ui/webui/help/version_updater_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698