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

Unified Diff: chrome/browser/chromeos/upgrade_detector_chromeos.cc

Issue 8568020: chromeos: Explicitly initialize and shut down UpgradeDetectorChromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix UpdateScreenTest Created 9 years, 1 month 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/upgrade_detector_chromeos.cc
diff --git a/chrome/browser/chromeos/upgrade_detector_chromeos.cc b/chrome/browser/chromeos/upgrade_detector_chromeos.cc
index e8fe6c5df78ba0a4875829c7fdd39b3c18e37a52..653c4bb5a3b2ffe0a054d68cbdfc65b376ace4e3 100644
--- a/chrome/browser/chromeos/upgrade_detector_chromeos.cc
+++ b/chrome/browser/chromeos/upgrade_detector_chromeos.cc
@@ -15,12 +15,22 @@ const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes.
} // namespace
-UpgradeDetectorChromeos::UpgradeDetectorChromeos() {
+UpgradeDetectorChromeos::UpgradeDetectorChromeos() : initialized_(false) {
+}
+
+UpgradeDetectorChromeos::~UpgradeDetectorChromeos() {
+}
+
+void UpgradeDetectorChromeos::Init() {
if (chromeos::CrosLibrary::Get())
chromeos::CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this);
+ initialized_ = true;
}
-UpgradeDetectorChromeos::~UpgradeDetectorChromeos() {
+void UpgradeDetectorChromeos::Shutdown() {
+ // Init() may not be called from tests (ex. BrowserMainTest).
+ if (!initialized_)
+ return;
if (chromeos::CrosLibrary::Get())
chromeos::CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this);
}
« no previous file with comments | « chrome/browser/chromeos/upgrade_detector_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698