Index: chrome/browser/chromeos/login/screens/update_screen.h |
diff --git a/chrome/browser/chromeos/login/screens/update_screen.h b/chrome/browser/chromeos/login/screens/update_screen.h |
index 2c60ba4ea9237bda0af6bc0d8f7464c57479027b..a3fd36c3555d4f55ce14a26a804e506b80aca749 100644 |
--- a/chrome/browser/chromeos/login/screens/update_screen.h |
+++ b/chrome/browser/chromeos/login/screens/update_screen.h |
@@ -14,8 +14,8 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/time/time.h" |
#include "base/timer/timer.h" |
-#include "chrome/browser/chromeos/login/screens/base_screen.h" |
#include "chrome/browser/chromeos/login/screens/error_screen.h" |
+#include "chrome/browser/chromeos/login/screens/update_model.h" |
#include "chromeos/dbus/update_engine_client.h" |
#include "chromeos/network/portal_detector/network_portal_detector.h" |
#include "components/pairing/host_pairing_controller.h" |
@@ -30,26 +30,29 @@ |
class UpdateView; |
// Controller for the update screen. |
-class UpdateScreen : public BaseScreen, |
+class UpdateScreen : public UpdateModel, |
public UpdateEngineClient::Observer, |
public NetworkPortalDetector::Observer { |
public: |
- static UpdateScreen* Get(ScreenManager* manager); |
- |
- // Returns true if this instance is still active (i.e. has not been deleted). |
- static bool HasInstance(UpdateScreen* inst); |
- |
UpdateScreen(BaseScreenDelegate* base_screen_delegate, |
UpdateView* view, |
pairing_chromeos::HostPairingController* remora_controller); |
~UpdateScreen() override; |
- // Called when the being destroyed. This should call Unbind() on the |
- // associated View if this class is destroyed before it. |
- void OnViewDestroyed(UpdateView* view); |
+ static UpdateScreen* Get(ScreenManager* manager); |
+ |
+ // UpdateModel: |
+ void Show() override; |
+ void Hide() override; |
+ void OnViewDestroyed(UpdateView* view) override; |
+ void OnUserAction(const std::string& action_id) override; |
+ void OnContextKeyUpdated(const ::login::ScreenContext::KeyType& key) override; |
// Starts network check. Made virtual to simplify mocking. |
virtual void StartNetworkCheck(); |
+ |
+ // Returns true if this instance is still active (i.e. has not been deleted). |
+ static bool HasInstance(UpdateScreen* inst); |
void SetIgnoreIdleStatus(bool ignore_idle_status); |
@@ -80,17 +83,12 @@ |
FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); |
FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestAPReselection); |
- enum class State { |
+ enum State { |
STATE_IDLE = 0, |
STATE_FIRST_PORTAL_CHECK, |
STATE_UPDATE, |
STATE_ERROR |
}; |
- |
- // BaseScreen: |
- void Show() override; |
- void Hide() override; |
- void OnUserAction(const std::string& action_id) override; |
// Updates downloading stats (remaining time and downloading |
// progress) on the AU screen. |
@@ -130,54 +128,52 @@ |
base::OneShotTimer reboot_timer_; |
// Returns a static InstanceSet. |
- // TODO(jdufault): There should only ever be one instance of this class. |
- // Remove support for supporting multiple instances. See crbug.com/672142. |
typedef std::set<UpdateScreen*> InstanceSet; |
static InstanceSet& GetInstanceSet(); |
// Current state of the update screen. |
- State state_ = State::STATE_IDLE; |
+ State state_; |
// Time in seconds after which we decide that the device has not rebooted |
// automatically. If reboot didn't happen during this interval, ask user to |
// reboot device manually. |
- int reboot_check_delay_ = 0; |
+ int reboot_check_delay_; |
// True if in the process of checking for update. |
- bool is_checking_for_update_ = true; |
+ bool is_checking_for_update_; |
// Flag that is used to detect when update download has just started. |
- bool is_downloading_update_ = false; |
+ bool is_downloading_update_; |
// If true, update deadlines are ignored. |
// Note, this is false by default. |
- bool is_ignore_update_deadlines_ = false; |
+ bool is_ignore_update_deadlines_; |
// Whether the update screen is shown. |
- bool is_shown_ = false; |
+ bool is_shown_; |
// Ignore fist IDLE status that is sent before update screen initiated check. |
- bool ignore_idle_status_ = true; |
+ bool ignore_idle_status_; |
- UpdateView* view_ = nullptr; |
+ UpdateView* view_; |
// Used to track updates over Bluetooth. |
pairing_chromeos::HostPairingController* remora_controller_; |
// Time of the first notification from the downloading stage. |
base::Time download_start_time_; |
- double download_start_progress_ = 0; |
+ double download_start_progress_; |
// Time of the last notification from the downloading stage. |
base::Time download_last_time_; |
- double download_last_progress_ = 0; |
+ double download_last_progress_; |
- bool is_download_average_speed_computed_ = false; |
- double download_average_speed_ = 0; |
+ bool is_download_average_speed_computed_; |
+ double download_average_speed_; |
// True if there was no notification from NetworkPortalDetector |
// about state for the default network. |
- bool is_first_detection_notification_ = true; |
+ bool is_first_detection_notification_; |
// True if there was no notification about captive portal state for |
// the default network. |
- bool is_first_portal_notification_ = true; |
+ bool is_first_portal_notification_; |
std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_; |