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

Unified Diff: chrome/browser/upgrade_detector.h

Issue 7046096: Refactor UpgradeDetector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and address finnur's comments in set 2 Created 9 years, 6 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
« no previous file with comments | « chrome/browser/chromeos/upgrade_detector_chromeos.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/upgrade_detector.h
diff --git a/chrome/browser/upgrade_detector.h b/chrome/browser/upgrade_detector.h
index 00227d5d7aee8732300895ce754b57af32e004a3..31ac7090336a55fa2cc7d0ef33099d494bd77933 100644
--- a/chrome/browser/upgrade_detector.h
+++ b/chrome/browser/upgrade_detector.h
@@ -9,7 +9,6 @@
#include "base/timer.h"
#include "ui/gfx/image.h"
-template <typename T> struct DefaultSingletonTraits;
class PrefService;
///////////////////////////////////////////////////////////////////////////////
@@ -39,10 +38,10 @@ class UpgradeDetector {
UPGRADE_ICON_TYPE_MENU_ICON, // For showing in the wrench menu.
};
- // Returns the singleton instance.
+ // Returns the singleton implementation instance.
static UpgradeDetector* GetInstance();
- ~UpgradeDetector();
+ virtual ~UpgradeDetector();
static void RegisterPrefs(PrefService* prefs);
@@ -55,41 +54,28 @@ class UpgradeDetector {
// within the wrench menu.
int GetIconResourceID(UpgradeNotificationIconType type);
- private:
- friend struct DefaultSingletonTraits<UpgradeDetector>;
-
+ protected:
UpgradeDetector();
- // Launches a task on the file thread to check if we have the latest version.
- void CheckForUpgrade();
-
- // Sends out a notification and starts a one shot timer to wait until
- // notifying the user.
- void UpgradeDetected();
+ // Sends out UPGRADE_DETECTED notification and record upgrade_detected_time_.
+ void NotifyUpgradeDetected();
- // The function that sends out a notification (after a certain time has
- // elapsed) that lets the rest of the UI know we should start notifying the
- // user that a new version is available.
- void NotifyOnUpgrade();
+ // Sends out UPGRADE_RECOMMENDED notification and set notify_upgrade_.
+ void NotifyUpgradeRecommended();
- // We periodically check to see if Chrome has been upgraded.
- base::RepeatingTimer<UpgradeDetector> detect_upgrade_timer_;
+ // Accessors.
+ const base::Time& upgrade_detected_time() const {
+ return upgrade_detected_time_;
+ }
- // After we detect an upgrade we start a recurring timer to see if enough time
- // has passed and we should start notifying the user.
- base::RepeatingTimer<UpgradeDetector> upgrade_notification_timer_;
-
- // We use this factory to create callback tasks for UpgradeDetected. We pass
- // the task to the actual upgrade detection code, which is in
- // DetectUpgradeTask.
- ScopedRunnableMethodFactory<UpgradeDetector> method_factory_;
+ void set_upgrade_notification_stage(UpgradeNotificationAnnoyanceLevel stage) {
+ upgrade_notification_stage_ = stage;
+ }
+ private:
// When the upgrade was detected.
base::Time upgrade_detected_time_;
- // True if this build is a dev or canary channel build.
- bool is_unstable_channel_;
-
// The stage at which the annoyance level for upgrade notifications is at.
UpgradeNotificationAnnoyanceLevel upgrade_notification_stage_;
« no previous file with comments | « chrome/browser/chromeos/upgrade_detector_chromeos.cc ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698