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

Side by Side Diff: chrome/browser/chromeos/upgrade_detector_chromeos.cc

Issue 8585025: chromeos: Change all clients of UpdateLibrary to use UpdateEngineClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" 5 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
9 9
10 namespace { 10 namespace {
11 11
12 // How long to wait (each cycle) before checking which severity level we should 12 // How long to wait (each cycle) before checking which severity level we should
13 // be at. Once we reach the highest severity, the timer will stop. 13 // be at. Once we reach the highest severity, the timer will stop.
14 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes. 14 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes.
15 15
16 } // namespace 16 } // namespace
17 17
18 using chromeos::DBusThreadManager;
19 using chromeos::UpdateEngineClient;
20
18 UpgradeDetectorChromeos::UpgradeDetectorChromeos() : initialized_(false) { 21 UpgradeDetectorChromeos::UpgradeDetectorChromeos() : initialized_(false) {
19 } 22 }
20 23
21 UpgradeDetectorChromeos::~UpgradeDetectorChromeos() { 24 UpgradeDetectorChromeos::~UpgradeDetectorChromeos() {
22 } 25 }
23 26
24 void UpgradeDetectorChromeos::Init() { 27 void UpgradeDetectorChromeos::Init() {
25 if (chromeos::CrosLibrary::Get()) 28 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
26 chromeos::CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this);
27 initialized_ = true; 29 initialized_ = true;
28 } 30 }
29 31
30 void UpgradeDetectorChromeos::Shutdown() { 32 void UpgradeDetectorChromeos::Shutdown() {
31 // Init() may not be called from tests (ex. BrowserMainTest). 33 // Init() may not be called from tests.
32 if (!initialized_) 34 if (!initialized_)
33 return; 35 return;
34 if (chromeos::CrosLibrary::Get()) 36 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
35 chromeos::CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this);
36 } 37 }
37 38
38 void UpgradeDetectorChromeos::UpdateStatusChanged( 39 void UpgradeDetectorChromeos::UpdateStatusChanged(
39 const chromeos::UpdateLibrary::Status& status) { 40 const UpdateEngineClient::Status& status) {
40 if (status.status != chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) 41 if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT)
41 return; 42 return;
42 43
43 NotifyUpgradeDetected(); 44 NotifyUpgradeDetected();
44 45
45 // ChromeOS shows upgrade arrow once the upgrade becomes available. 46 // ChromeOS shows upgrade arrow once the upgrade becomes available.
46 NotifyOnUpgrade(); 47 NotifyOnUpgrade();
47 48
48 // Setup timer to to move along the upgrade advisory system. 49 // Setup timer to to move along the upgrade advisory system.
49 upgrade_notification_timer_.Start( 50 upgrade_notification_timer_.Start(
50 FROM_HERE, base::TimeDelta::FromMilliseconds(kNotifyCycleTimeMs), 51 FROM_HERE, base::TimeDelta::FromMilliseconds(kNotifyCycleTimeMs),
(...skipping 30 matching lines...) Expand all
81 82
82 // static 83 // static
83 UpgradeDetectorChromeos* UpgradeDetectorChromeos::GetInstance() { 84 UpgradeDetectorChromeos* UpgradeDetectorChromeos::GetInstance() {
84 return Singleton<UpgradeDetectorChromeos>::get(); 85 return Singleton<UpgradeDetectorChromeos>::get();
85 } 86 }
86 87
87 // static 88 // static
88 UpgradeDetector* UpgradeDetector::GetInstance() { 89 UpgradeDetector* UpgradeDetector::GetInstance() {
89 return UpgradeDetectorChromeos::GetInstance(); 90 return UpgradeDetectorChromeos::GetInstance();
90 } 91 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/upgrade_detector_chromeos.h ('k') | chrome/browser/policy/device_policy_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698