| 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_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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // interface and will delete itself after reporting back. | 85 // interface and will delete itself after reporting back. |
| 86 // | 86 // |
| 87 //////////////////////////////////////////////////////////////////////////////// | 87 //////////////////////////////////////////////////////////////////////////////// |
| 88 class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> { | 88 class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> { |
| 89 public: | 89 public: |
| 90 GoogleUpdate(); | 90 GoogleUpdate(); |
| 91 | 91 |
| 92 // Ask Google Update to see if a new version is available. If the parameter | 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 | 93 // |install_if_newer| is true then Google Update will also install that new |
| 94 // version. | 94 // version. |
| 95 // |window| should point to a foreground window. This is needed to ensure | 95 void CheckForUpdate(bool install_if_newer); |
| 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 | 96 |
| 100 // Pass NULL to clear the listener | 97 // Pass NULL to clear the listener |
| 101 void set_status_listener(GoogleUpdateStatusListener* listener) { | 98 void set_status_listener(GoogleUpdateStatusListener* listener) { |
| 102 listener_ = listener; | 99 listener_ = listener; |
| 103 } | 100 } |
| 104 | 101 |
| 105 private: | 102 private: |
| 106 friend class base::RefCountedThreadSafe<GoogleUpdate>; | 103 friend class base::RefCountedThreadSafe<GoogleUpdate>; |
| 107 | 104 |
| 108 virtual ~GoogleUpdate(); | 105 virtual ~GoogleUpdate(); |
| 109 | 106 |
| 110 // The chromeos implementation is in browser/chromeos/google_update.cpp | 107 // The chromeos implementation is in browser/chromeos/google_update.cpp |
| 111 | 108 |
| 112 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| 113 | 110 |
| 114 // This function reports failure from the Google Update operation to the | 111 // This function reports failure from the Google Update operation to the |
| 115 // listener. | 112 // listener. |
| 116 // Note, after this function completes, this object will have deleted itself. | 113 // Note, after this function completes, this object will have deleted itself. |
| 117 bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 114 bool ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
| 118 const string16& error_message, MessageLoop* main_loop); | 115 const string16& error_message, MessageLoop* main_loop); |
| 119 | 116 |
| 120 #endif | 117 #endif |
| 121 | 118 |
| 122 // We need to run the update check on another thread than the main thread, and | 119 // 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 | 120 // therefore CheckForUpdate will delegate to this function. |main_loop| points |
| 124 // to the message loop that we want the response to come from. | 121 // 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 | 122 // |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. | 123 // 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, | 124 void InitiateGoogleUpdateCheck(bool install_if_newer, MessageLoop* main_loop); |
| 128 MessageLoop* main_loop); | |
| 129 | 125 |
| 130 // This function reports the results of the GoogleUpdate operation to the | 126 // This function reports the results of the GoogleUpdate operation to the |
| 131 // listener. If results indicates an error, the |error_code| and | 127 // listener. If results indicates an error, the |error_code| and |
| 132 // |error_message| will indicate which error occurred. | 128 // |error_message| will indicate which error occurred. |
| 133 // Note, after this function completes, this object will have deleted itself. | 129 // Note, after this function completes, this object will have deleted itself. |
| 134 void ReportResults(GoogleUpdateUpgradeResult results, | 130 void ReportResults(GoogleUpdateUpgradeResult results, |
| 135 GoogleUpdateErrorCode error_code, | 131 GoogleUpdateErrorCode error_code, |
| 136 const string16& error_message); | 132 const string16& error_message); |
| 137 | 133 |
| 138 // Which version string Google Update found (if a new one was available). | 134 // Which version string Google Update found (if a new one was available). |
| 139 // Otherwise, this will be blank. | 135 // Otherwise, this will be blank. |
| 140 string16 version_available_; | 136 string16 version_available_; |
| 141 | 137 |
| 142 // The listener who is interested in finding out the result of the operation. | 138 // The listener who is interested in finding out the result of the operation. |
| 143 GoogleUpdateStatusListener* listener_; | 139 GoogleUpdateStatusListener* listener_; |
| 144 | 140 |
| 145 DISALLOW_COPY_AND_ASSIGN(GoogleUpdate); | 141 DISALLOW_COPY_AND_ASSIGN(GoogleUpdate); |
| 146 }; | 142 }; |
| 147 | 143 |
| 148 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ | 144 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_H_ |
| OLD | NEW |