| 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_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/ui/webui/help/version_updater.h" | 10 #include "chrome/browser/ui/webui/help/version_updater.h" |
| 11 #include "chromeos/dbus/update_engine_client.h" | 11 #include "chromeos/dbus/update_engine_client.h" |
| 12 | 12 |
| 13 class VersionUpdaterCros : public VersionUpdater, | 13 class VersionUpdaterCros : public VersionUpdater, |
| 14 public chromeos::UpdateEngineClient::Observer { | 14 public chromeos::UpdateEngineClient::Observer { |
| 15 public: | 15 public: |
| 16 // VersionUpdater implementation. | 16 // VersionUpdater implementation. |
| 17 virtual void CheckForUpdate(const StatusCallback& callback) OVERRIDE; | 17 virtual void CheckForUpdate(const StatusCallback& callback) OVERRIDE; |
| 18 virtual void RelaunchBrowser() const OVERRIDE; | 18 virtual void RelaunchBrowser() const OVERRIDE; |
| 19 virtual void SetChannel(const std::string& channel, | 19 virtual void SetChannel(const std::string& channel, |
| 20 bool is_powerwash_allowed) OVERRIDE; | 20 bool is_powerwash_allowed) OVERRIDE; |
| 21 virtual void GetChannel(bool get_current_channel, | 21 virtual void GetChannel(bool get_current_channel, |
| 22 const ChannelCallback& callback) OVERRIDE; | 22 const ChannelCallback& callback) OVERRIDE; |
| 23 | 23 |
| 24 // Gets the last update status, without triggering a new check or download. |
| 25 void GetUpdateStatus(const StatusCallback& callback); |
| 26 |
| 24 protected: | 27 protected: |
| 25 friend class VersionUpdater; | 28 friend class VersionUpdater; |
| 26 | 29 |
| 27 // Clients must use VersionUpdater::Create(). | 30 // Clients must use VersionUpdater::Create(). |
| 28 VersionUpdaterCros(); | 31 VersionUpdaterCros(); |
| 29 virtual ~VersionUpdaterCros(); | 32 virtual ~VersionUpdaterCros(); |
| 30 | 33 |
| 31 private: | 34 private: |
| 32 // UpdateEngineClient::Observer implementation. | 35 // UpdateEngineClient::Observer implementation. |
| 33 virtual void UpdateStatusChanged( | 36 virtual void UpdateStatusChanged( |
| 34 const chromeos::UpdateEngineClient::Status& status) OVERRIDE; | 37 const chromeos::UpdateEngineClient::Status& status) OVERRIDE; |
| 35 | 38 |
| 36 // Callback from UpdateEngineClient::RequestUpdateCheck(). | 39 // Callback from UpdateEngineClient::RequestUpdateCheck(). |
| 37 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); | 40 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); |
| 38 | 41 |
| 39 // Callback used to communicate update status to the client. | 42 // Callback used to communicate update status to the client. |
| 40 StatusCallback callback_; | 43 StatusCallback callback_; |
| 41 | 44 |
| 42 // Last state received via UpdateStatusChanged(). | 45 // Last state received via UpdateStatusChanged(). |
| 43 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; | 46 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; |
| 44 | 47 |
| 45 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; | 48 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; |
| 46 | 49 |
| 47 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); | 50 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ | 53 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ |
| OLD | NEW |