Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1119)

Unified Diff: chrome/browser/chromeos/login/screens/update_screen.h

Issue 2673943002: Fold UpdateModel into UpdateScreen. (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a3fd36c3555d4f55ce14a26a804e506b80aca749..2c60ba4ea9237bda0af6bc0d8f7464c57479027b 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,30 +30,27 @@ class ScreenManager;
class UpdateView;
// Controller for the update screen.
-class UpdateScreen : public UpdateModel,
+class UpdateScreen : public BaseScreen,
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;
- 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;
+ // Called when the being destroyed. This should call Unbind() on the
+ // associated View if this class is destroyed before it.
+ void OnViewDestroyed(UpdateView* view);
// 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);
enum ExitReason {
@@ -83,13 +80,18 @@ class UpdateScreen : public UpdateModel,
FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable);
FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestAPReselection);
- enum State {
+ enum class 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.
void UpdateDownloadingStats(const UpdateEngineClient::Status& status);
@@ -128,52 +130,54 @@ class UpdateScreen : public UpdateModel,
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_ = State::STATE_IDLE;
// 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_;
+ int reboot_check_delay_ = 0;
// True if in the process of checking for update.
- bool is_checking_for_update_;
+ bool is_checking_for_update_ = true;
// Flag that is used to detect when update download has just started.
- bool is_downloading_update_;
+ bool is_downloading_update_ = false;
// If true, update deadlines are ignored.
// Note, this is false by default.
- bool is_ignore_update_deadlines_;
+ bool is_ignore_update_deadlines_ = false;
// Whether the update screen is shown.
- bool is_shown_;
+ bool is_shown_ = false;
// Ignore fist IDLE status that is sent before update screen initiated check.
- bool ignore_idle_status_;
+ bool ignore_idle_status_ = true;
- UpdateView* view_;
+ UpdateView* view_ = nullptr;
// 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_;
+ double download_start_progress_ = 0;
// Time of the last notification from the downloading stage.
base::Time download_last_time_;
- double download_last_progress_;
+ double download_last_progress_ = 0;
- bool is_download_average_speed_computed_;
- double download_average_speed_;
+ bool is_download_average_speed_computed_ = false;
+ double download_average_speed_ = 0;
// True if there was no notification from NetworkPortalDetector
// about state for the default network.
- bool is_first_detection_notification_;
+ bool is_first_detection_notification_ = true;
// True if there was no notification about captive portal state for
// the default network.
- bool is_first_portal_notification_;
+ bool is_first_portal_notification_ = true;
std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_;
« no previous file with comments | « chrome/browser/chromeos/login/screens/update_model.cc ('k') | chrome/browser/chromeos/login/screens/update_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698