| 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/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.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 { | |
| 17 class SingleThreadTaskRunner; | |
| 18 } // namespace base | |
| 19 | |
| 20 // These values are used for a histogram. Do not reorder. | 16 // These values are used for a histogram. Do not reorder. |
| 21 enum GoogleUpdateErrorCode { | 17 enum GoogleUpdateErrorCode { |
| 22 // The upgrade completed successfully (or hasn't been started yet). | 18 // The upgrade completed successfully (or hasn't been started yet). |
| 23 GOOGLE_UPDATE_NO_ERROR = 0, | 19 GOOGLE_UPDATE_NO_ERROR = 0, |
| 24 // Google Update only supports upgrading if Chrome is installed in the default | 20 // Google Update only supports upgrading if Chrome is installed in the default |
| 25 // location. This error will appear for developer builds and with | 21 // location. This error will appear for developer builds and with |
| 26 // installations unzipped to random locations. | 22 // installations unzipped to random locations. |
| 27 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1, | 23 CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1, |
| 28 // Failed to create Google Update JobServer COM class. DEPRECATED. | 24 // Failed to create Google Update JobServer COM class. DEPRECATED. |
| 29 // GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2, | 25 // GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // state information). |new_version|, if not empty, indicates the version | 76 // state information). |new_version|, if not empty, indicates the version |
| 81 // to which an upgrade attempt was made. | 77 // to which an upgrade attempt was made. |
| 82 virtual void OnError(GoogleUpdateErrorCode error_code, | 78 virtual void OnError(GoogleUpdateErrorCode error_code, |
| 83 const base::string16& html_error_message, | 79 const base::string16& html_error_message, |
| 84 const base::string16& new_version) = 0; | 80 const base::string16& new_version) = 0; |
| 85 | 81 |
| 86 protected: | 82 protected: |
| 87 UpdateCheckDelegate() {} | 83 UpdateCheckDelegate() {} |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 // Begins an asynchronous update check on |task_runner|. If a new version is | 86 // Begins an asynchronous update check. If a new version is |
| 91 // available and |install_update_if_possible| is true, the new version will be | 87 // available and |install_update_if_possible| is true, the new version will be |
| 92 // automatically downloaded and installed. |elevation_window| is the window | 88 // automatically downloaded and installed. |elevation_window| is the window |
| 93 // which should own any necessary elevation UI. Methods on |delegate| will be | 89 // which should own any necessary elevation UI. Methods on |delegate| will be |
| 94 // invoked on the caller's thread to provide feedback on the operation, with | 90 // invoked on the caller's thread to provide feedback on the operation, with |
| 95 // messages localized to |locale| if possible. | 91 // messages localized to |locale| if possible. |
| 96 void BeginUpdateCheck( | 92 void BeginUpdateCheck( |
| 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 98 const std::string& locale, | 93 const std::string& locale, |
| 99 bool install_update_if_possible, | 94 bool install_update_if_possible, |
| 100 gfx::AcceleratedWidget elevation_window, | 95 gfx::AcceleratedWidget elevation_window, |
| 101 const base::WeakPtr<UpdateCheckDelegate>& delegate); | 96 const base::WeakPtr<UpdateCheckDelegate>& delegate); |
| 102 | 97 |
| 103 // A type of callback supplied by tests to provide a custom IGoogleUpdate3Web | 98 // A type of callback supplied by tests to provide a custom IGoogleUpdate3Web |
| 104 // implementation (see src/google_update/google_update_idl.idl). | 99 // implementation (see src/google_update/google_update_idl.idl). |
| 105 typedef base::Callback<HRESULT(base::win::ScopedComPtr<IGoogleUpdate3Web>*)> | 100 typedef base::Callback<HRESULT(base::win::ScopedComPtr<IGoogleUpdate3Web>*)> |
| 106 GoogleUpdate3ClassFactory; | 101 GoogleUpdate3ClassFactory; |
| 107 | 102 |
| 108 // For use by tests that wish to provide a custom IGoogleUpdate3Web | 103 // For use by tests that wish to provide a custom IGoogleUpdate3Web |
| 109 // implementation independent of Google Update's. | 104 // implementation independent of Google Update's. |
| 110 void SetGoogleUpdateFactoryForTesting( | 105 void SetGoogleUpdateFactoryForTesting( |
| 111 const GoogleUpdate3ClassFactory& google_update_factory); | 106 const GoogleUpdate3ClassFactory& google_update_factory); |
| 112 | 107 |
| 113 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ | 108 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UPDATE_WIN_H_ |
| OLD | NEW |