Index: chrome/browser/chromeos/login/update_screen.h |
diff --git a/chrome/browser/chromeos/login/update_screen.h b/chrome/browser/chromeos/login/update_screen.h |
index c1afb0d9409b71f21ebd7121dc863c41861d8d99..0d5f04a2636b91ae93d1e7afa71b2518915a408d 100644 |
--- a/chrome/browser/chromeos/login/update_screen.h |
+++ b/chrome/browser/chromeos/login/update_screen.h |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -6,37 +6,46 @@ |
#define CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ |
#pragma once |
+#include <set> |
+ |
+#include "base/gtest_prod_util.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/timer.h" |
#include "chrome/browser/chromeos/cros/update_library.h" |
-#include "chrome/browser/chromeos/login/update_view.h" |
-#include "chrome/browser/chromeos/login/view_screen.h" |
+#include "chrome/browser/chromeos/login/wizard_screen.h" |
namespace chromeos { |
-class UpdateController { |
- public: |
- // Starts update. |
- virtual void StartUpdate() = 0; |
- // Cancels pending update without error. |
- virtual void CancelUpdate() = 0; |
-}; |
+// Forward declaration. |
+class UpdateScreenActor; |
-class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>, |
- public UpdateLibrary::Observer, |
- public UpdateController { |
+// Controller for the update screen. It does not depend on the specific |
+// implementation of the screen showing (Views of WebUI based), the dependency |
+// is moved to the UpdateScreenActor instead. |
+class UpdateScreen: public UpdateLibrary::Observer, |
+ public WizardScreen { |
public: |
explicit UpdateScreen(WizardScreenDelegate* delegate); |
virtual ~UpdateScreen(); |
- // UpdateLibrary::Observer implementation: |
- virtual void UpdateStatusChanged(UpdateLibrary* library); |
+ // Overridden from WizardScreen. |
+ virtual void Show(); |
+ virtual void Hide(); |
+ virtual gfx::Size GetScreenSize() const; |
- // Overridden from UpdateController: |
+ // Checks for updates and performs an update if needed. Made virtual to |
+ // simplify mocking. |
virtual void StartUpdate(); |
+ |
+ // Force cancel update. Made virtual to simplify mocking. |
virtual void CancelUpdate(); |
- // Overridden from ViewScreen. |
- virtual void Show(); |
+ // Reboot check delay get/set, in seconds. |
+ int reboot_check_delay() const { return reboot_check_delay_; } |
+ void SetRebootCheckDelay(int seconds); |
+ |
+ // Returns true if this instance is still active (i.e. has not been deleted). |
+ static bool HasInstance(UpdateScreen* inst); |
enum ExitReason { |
REASON_UPDATE_CANCELED, |
@@ -44,26 +53,20 @@ class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>, |
REASON_UPDATE_NON_CRITICAL, |
REASON_UPDATE_ENDED |
}; |
- |
// Reports update results to the ScreenObserver. |
virtual void ExitUpdate(ExitReason reason); |
- // Reboot check delay get/set, in seconds. |
- int reboot_check_delay() const { return reboot_check_delay_; } |
- void SetRebootCheckDelay(int seconds); |
+ // UpdateLibrary::Observer implementation: |
+ virtual void UpdateStatusChanged(UpdateLibrary* library); |
+ |
+ private: |
+ FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); |
+ FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); |
// Returns true if there is critical system update that requires installation |
// and immediate reboot. |
bool HasCriticalUpdate(); |
- // Set flag to treat all updates as critical (for test purpose mainly). |
- // Default value is false. |
- void SetAllUpdatesCritical(bool is_critical); |
- |
- // Returns true if this instance is still active (i.e. has not been deleted). |
- static bool HasInstance(UpdateScreen* inst); |
- |
- private: |
// Timer notification handlers. |
void OnWaitForRebootTimeElapsed(); |
@@ -78,19 +81,23 @@ class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>, |
typedef std::set<UpdateScreen*> InstanceSet; |
static InstanceSet& GetInstanceSet(); |
- // True if in the process of checking for update. |
- bool checking_for_update_; |
- |
// 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_; |
+ // True if in the process of checking for update. |
+ bool is_checking_for_update_; |
// Flag that is used to detect when update download has just started. |
bool is_downloading_update_; |
- |
- // Is all updates critical? If true, update deadlines are ignored. |
- bool is_all_updates_critical_; |
+ // If true, update deadlines are ignored. |
+ // Note, this is true by default. See "http://crosbug.com/10068". |
+ bool is_ignore_update_deadlines_; |
+ // Whether the update screen is shown. |
+ bool is_shown_; |
+ |
+ // Keeps actor which is delegated with all showing operations. |
+ scoped_ptr<UpdateScreenActor> actor_; |
DISALLOW_COPY_AND_ASSIGN(UpdateScreen); |
}; |