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 namespace content { |
| 14 class BrowserContext; |
| 15 class WebContents; |
| 16 } |
| 17 |
13 class VersionUpdaterCros : public VersionUpdater, | 18 class VersionUpdaterCros : public VersionUpdater, |
14 public chromeos::UpdateEngineClient::Observer { | 19 public chromeos::UpdateEngineClient::Observer { |
15 public: | 20 public: |
16 // VersionUpdater implementation. | 21 // VersionUpdater implementation. |
17 void CheckForUpdate(const StatusCallback& callback) override; | 22 void CheckForUpdate(const StatusCallback& callback) override; |
18 void RelaunchBrowser() const override; | 23 void RelaunchBrowser() const override; |
19 void SetChannel(const std::string& channel, | 24 void SetChannel(const std::string& channel, |
20 bool is_powerwash_allowed) override; | 25 bool is_powerwash_allowed) override; |
21 void GetChannel(bool get_current_channel, | 26 void GetChannel(bool get_current_channel, |
22 const ChannelCallback& callback) override; | 27 const ChannelCallback& callback) override; |
23 | 28 |
24 // Gets the last update status, without triggering a new check or download. | 29 // Gets the last update status, without triggering a new check or download. |
25 void GetUpdateStatus(const StatusCallback& callback); | 30 void GetUpdateStatus(const StatusCallback& callback); |
26 | 31 |
27 protected: | 32 protected: |
28 friend class VersionUpdater; | 33 friend class VersionUpdater; |
29 | 34 |
30 // Clients must use VersionUpdater::Create(). | 35 // Clients must use VersionUpdater::Create(). |
31 explicit VersionUpdaterCros(content::BrowserContext* context); | 36 explicit VersionUpdaterCros(content::WebContents* web_contents); |
32 ~VersionUpdaterCros() override; | 37 ~VersionUpdaterCros() override; |
33 | 38 |
34 private: | 39 private: |
35 // UpdateEngineClient::Observer implementation. | 40 // UpdateEngineClient::Observer implementation. |
36 void UpdateStatusChanged( | 41 void UpdateStatusChanged( |
37 const chromeos::UpdateEngineClient::Status& status) override; | 42 const chromeos::UpdateEngineClient::Status& status) override; |
38 | 43 |
39 // Callback from UpdateEngineClient::RequestUpdateCheck(). | 44 // Callback from UpdateEngineClient::RequestUpdateCheck(). |
40 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); | 45 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); |
41 | 46 |
42 // BrowserContext in which the class was instantiated. | 47 // BrowserContext in which the class was instantiated. |
43 content::BrowserContext* context_; | 48 content::BrowserContext* context_; |
44 | 49 |
45 // Callback used to communicate update status to the client. | 50 // Callback used to communicate update status to the client. |
46 StatusCallback callback_; | 51 StatusCallback callback_; |
47 | 52 |
48 // Last state received via UpdateStatusChanged(). | 53 // Last state received via UpdateStatusChanged(). |
49 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; | 54 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; |
50 | 55 |
51 // True if an update check should be scheduled when the update engine is idle. | 56 // True if an update check should be scheduled when the update engine is idle. |
52 bool check_for_update_when_idle_; | 57 bool check_for_update_when_idle_; |
53 | 58 |
54 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; | 59 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; |
55 | 60 |
56 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); | 61 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); |
57 }; | 62 }; |
58 | 63 |
59 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ |
OLD | NEW |