Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / upgrade_detector_chromeos.h
blob0bca5eafd90ecc3ebfe4699f6f881797421db8fa
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_UPGRADE_DETECTOR_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_UPGRADE_DETECTOR_CHROMEOS_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/timer/timer.h"
11 #include "chrome/browser/upgrade_detector.h"
12 #include "chromeos/dbus/update_engine_client.h"
14 template <typename T> struct DefaultSingletonTraits;
16 class UpgradeDetectorChromeos : public UpgradeDetector,
17 public chromeos::UpdateEngineClient::Observer {
18 public:
19 ~UpgradeDetectorChromeos() override;
21 static UpgradeDetectorChromeos* GetInstance();
23 // Initializes the object. Starts observing changes from the update
24 // engine.
25 void Init();
27 // Shuts down the object. Stops observing observe changes from the
28 // update engine.
29 void Shutdown();
31 private:
32 friend struct DefaultSingletonTraits<UpgradeDetectorChromeos>;
33 class ChannelsRequester;
35 UpgradeDetectorChromeos();
37 // chromeos::UpdateEngineClient::Observer implementation.
38 void UpdateStatusChanged(
39 const chromeos::UpdateEngineClient::Status& status) override;
41 // The function that sends out a notification (after a certain time has
42 // elapsed) that lets the rest of the UI know we should start notifying the
43 // user that a new version is available.
44 void NotifyOnUpgrade();
46 void OnChannelsReceived(const std::string& current_channel,
47 const std::string& target_channel);
49 // After we detect an upgrade we start a recurring timer to see if enough time
50 // has passed and we should start notifying the user.
51 base::RepeatingTimer<UpgradeDetectorChromeos> upgrade_notification_timer_;
52 bool initialized_;
53 base::Time upgrade_detected_time_;
55 scoped_ptr<ChannelsRequester> channels_requester_;
57 base::WeakPtrFactory<UpgradeDetectorChromeos> weak_factory_;
59 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorChromeos);
62 #endif // CHROME_BROWSER_CHROMEOS_UPGRADE_DETECTOR_CHROMEOS_H_