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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/ui/webui/help/version_updater.h" | 11 #include "chrome/browser/ui/webui/help/version_updater.h" |
12 #include "chromeos/dbus/update_engine_client.h" | 12 #include "chromeos/dbus/update_engine_client.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 class WebContents; | 16 class WebContents; |
17 } | 17 } |
18 | 18 |
19 class VersionUpdaterCros : public VersionUpdater, | 19 class VersionUpdaterCros : public VersionUpdater, |
20 public chromeos::UpdateEngineClient::Observer { | 20 public chromeos::UpdateEngineClient::Observer { |
21 public: | 21 public: |
22 // VersionUpdater implementation. | 22 // VersionUpdater implementation. |
23 void CheckForUpdate(const StatusCallback& callback, | 23 void CheckForUpdate(const StatusCallback& callback, |
24 const PromoteCallback&) override; | 24 const PromoteCallback&) override; |
25 void SetChannel(const std::string& channel, | 25 void SetChannel(const std::string& channel, |
26 bool is_powerwash_allowed) override; | 26 bool is_powerwash_allowed) override; |
27 void GetChannel(bool get_current_channel, | 27 void GetChannel(bool get_current_channel, |
28 const ChannelCallback& callback) override; | 28 const ChannelCallback& callback) override; |
| 29 void SetUpdateOverCellularTarget(const StatusCallback& callback, |
| 30 const std::string& target_version, |
| 31 int64_t target_size) override; |
29 | 32 |
30 // Gets the last update status, without triggering a new check or download. | 33 // Gets the last update status, without triggering a new check or download. |
31 void GetUpdateStatus(const StatusCallback& callback); | 34 void GetUpdateStatus(const StatusCallback& callback); |
32 | 35 |
33 void GetEolStatus(const EolStatusCallback& callback) override; | 36 void GetEolStatus(const EolStatusCallback& callback) override; |
34 | 37 |
35 protected: | 38 protected: |
36 friend class VersionUpdater; | 39 friend class VersionUpdater; |
37 | 40 |
38 // Clients must use VersionUpdater::Create(). | 41 // Clients must use VersionUpdater::Create(). |
39 explicit VersionUpdaterCros(content::WebContents* web_contents); | 42 explicit VersionUpdaterCros(content::WebContents* web_contents); |
40 ~VersionUpdaterCros() override; | 43 ~VersionUpdaterCros() override; |
41 | 44 |
42 private: | 45 private: |
43 // UpdateEngineClient::Observer implementation. | 46 // UpdateEngineClient::Observer implementation. |
44 void UpdateStatusChanged( | 47 void UpdateStatusChanged( |
45 const chromeos::UpdateEngineClient::Status& status) override; | 48 const chromeos::UpdateEngineClient::Status& status) override; |
46 | 49 |
47 // Callback from UpdateEngineClient::RequestUpdateCheck(). | 50 // Callback from UpdateEngineClient::RequestUpdateCheck(). |
48 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); | 51 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); |
49 | 52 |
| 53 // Callback from UpdateEngineClient::SetUpdateOverCellularTarget(). |
| 54 void OnSetUpdateOverCellularTarget(bool success); |
| 55 |
50 // Callback from UpdateEngineClient::GetChannel(). | 56 // Callback from UpdateEngineClient::GetChannel(). |
51 void OnGetChannel(const ChannelCallback& cb, | 57 void OnGetChannel(const ChannelCallback& cb, |
52 const std::string& current_channel); | 58 const std::string& current_channel); |
53 | 59 |
54 // Callback from UpdateEngineClient::GetEolStatus(). | 60 // Callback from UpdateEngineClient::GetEolStatus(). |
55 void OnGetEolStatus(const EolStatusCallback& cb, | 61 void OnGetEolStatus(const EolStatusCallback& cb, |
56 update_engine::EndOfLifeStatus status); | 62 update_engine::EndOfLifeStatus status); |
57 | 63 |
58 // BrowserContext in which the class was instantiated. | 64 // BrowserContext in which the class was instantiated. |
59 content::BrowserContext* context_; | 65 content::BrowserContext* context_; |
60 | 66 |
61 // Callback used to communicate update status to the client. | 67 // Callback used to communicate update status to the client. |
62 StatusCallback callback_; | 68 StatusCallback callback_; |
63 | 69 |
64 // Last state received via UpdateStatusChanged(). | 70 // Last state received via UpdateStatusChanged(). |
65 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; | 71 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; |
66 | 72 |
67 // True if an update check should be scheduled when the update engine is idle. | 73 // True if an update check should be scheduled when the update engine is idle. |
68 bool check_for_update_when_idle_; | 74 bool check_for_update_when_idle_; |
69 | 75 |
70 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; | 76 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; |
71 | 77 |
72 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); | 78 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); |
73 }; | 79 }; |
74 | 80 |
75 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ | 81 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ |
OLD | NEW |