OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/string16.h" |
13 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
14 #include "google_update_idl.h" | 13 #include "google_update_idl.h" |
15 #endif | 14 #endif |
16 | 15 |
17 class MessageLoop; | 16 class MessageLoop; |
18 namespace views { | 17 namespace views { |
19 class Widget; | 18 class Widget; |
20 } | 19 } |
21 | 20 |
22 // The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are | 21 // The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Updates can not be downloaded because the administrator has disabled them. | 59 // Updates can not be downloaded because the administrator has disabled them. |
61 GOOGLE_UPDATE_DISABLED_BY_POLICY, | 60 GOOGLE_UPDATE_DISABLED_BY_POLICY, |
62 }; | 61 }; |
63 | 62 |
64 // The GoogleUpdateStatusListener interface is used by components to receive | 63 // The GoogleUpdateStatusListener interface is used by components to receive |
65 // notifications about the results of an Google Update operation. | 64 // notifications about the results of an Google Update operation. |
66 class GoogleUpdateStatusListener { | 65 class GoogleUpdateStatusListener { |
67 public: | 66 public: |
68 // This function is called when Google Update has finished its operation and | 67 // This function is called when Google Update has finished its operation and |
69 // wants to notify us about the results. |results| represents what the end | 68 // wants to notify us about the results. |results| represents what the end |
70 // state is, |error_code| represents what error occurred and |version| | 69 // state is, |error_code| represents what error occurred, |error_message| is a |
71 // specifies what new version Google Update detected (or installed). This | 70 // string version of the same (might be blank) and |version| specifies what |
72 // value can be a blank string, if the version tag in the Update{} block | 71 // new version Google Update detected (or installed). This value can be a |
73 // (in Google Update's server config for Chrome) is blank. | 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, | 74 virtual void OnReportResults(GoogleUpdateUpgradeResult results, |
75 GoogleUpdateErrorCode error_code, | 75 GoogleUpdateErrorCode error_code, |
76 const std::wstring& version) = 0; | 76 const string16& error_message, |
| 77 const string16& version) = 0; |
77 }; | 78 }; |
78 | 79 |
79 //////////////////////////////////////////////////////////////////////////////// | 80 //////////////////////////////////////////////////////////////////////////////// |
80 // | 81 // |
81 // The Google Update class is responsible for communicating with Google Update | 82 // The Google Update class is responsible for communicating with Google Update |
82 // and get it to perform operations on our behalf (for example, CheckForUpdate). | 83 // and get it to perform operations on our behalf (for example, CheckForUpdate). |
83 // This class will report back to its parent via the GoogleUpdateStatusListener | 84 // This class will report back to its parent via the GoogleUpdateStatusListener |
84 // interface and will delete itself after reporting back. | 85 // interface and will delete itself after reporting back. |
85 // | 86 // |
86 //////////////////////////////////////////////////////////////////////////////// | 87 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 20 matching lines...) Expand all Loading... |
107 virtual ~GoogleUpdate(); | 108 virtual ~GoogleUpdate(); |
108 | 109 |
109 // The chromeos implementation is in browser/chromeos/google_update.cpp | 110 // The chromeos implementation is in browser/chromeos/google_update.cpp |
110 | 111 |
111 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
112 | 113 |
113 // This function reports failure from the Google Update operation to the | 114 // This function reports failure from the Google Update operation to the |
114 // listener. | 115 // listener. |
115 // Note, after this function completes, this object will have deleted itself. | 116 // Note, after this function completes, this object will have deleted itself. |
116 bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 117 bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
117 MessageLoop* main_loop); | 118 const string16& error_message, MessageLoop* main_loop); |
118 | 119 |
119 #endif | 120 #endif |
120 | 121 |
121 // We need to run the update check on another thread than the main thread, and | 122 // We need to run the update check on another thread than the main thread, and |
122 // therefore CheckForUpdate will delegate to this function. |main_loop| points | 123 // therefore CheckForUpdate will delegate to this function. |main_loop| points |
123 // to the message loop that we want the response to come from. | 124 // to the message loop that we want the response to come from. |
124 // |window| should point to a foreground window. This is needed to ensure that | 125 // |window| should point to a foreground window. This is needed to ensure that |
125 // Vista/Windows 7 UAC prompts show up in the foreground. It may also be null. | 126 // Vista/Windows 7 UAC prompts show up in the foreground. It may also be null. |
126 void InitiateGoogleUpdateCheck(bool install_if_newer, views::Widget* window, | 127 void InitiateGoogleUpdateCheck(bool install_if_newer, views::Widget* window, |
127 MessageLoop* main_loop); | 128 MessageLoop* main_loop); |
128 | 129 |
129 // This function reports the results of the GoogleUpdate operation to the | 130 // This function reports the results of the GoogleUpdate operation to the |
130 // listener. If results indicates an error, the error_code will indicate which | 131 // listener. If results indicates an error, the |error_code| and |
131 // error occurred. | 132 // |error_message| will indicate which error occurred. |
132 // Note, after this function completes, this object will have deleted itself. | 133 // Note, after this function completes, this object will have deleted itself. |
133 void ReportResults(GoogleUpdateUpgradeResult results, | 134 void ReportResults(GoogleUpdateUpgradeResult results, |
134 GoogleUpdateErrorCode error_code); | 135 GoogleUpdateErrorCode error_code, |
| 136 const string16& error_message); |
135 | 137 |
136 // Which version string Google Update found (if a new one was available). | 138 // Which version string Google Update found (if a new one was available). |
137 // Otherwise, this will be blank. | 139 // Otherwise, this will be blank. |
138 std::wstring version_available_; | 140 string16 version_available_; |
139 | 141 |
140 // The listener who is interested in finding out the result of the operation. | 142 // The listener who is interested in finding out the result of the operation. |
141 GoogleUpdateStatusListener* listener_; | 143 GoogleUpdateStatusListener* listener_; |
142 | 144 |
143 DISALLOW_COPY_AND_ASSIGN(GoogleUpdate); | 145 DISALLOW_COPY_AND_ASSIGN(GoogleUpdate); |
144 }; | 146 }; |
145 | 147 |
146 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ | 148 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ |
OLD | NEW |