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

Side by Side Diff: chrome/browser/upgrade_detector_impl.h

Issue 325433002: Elevated install of recovery component (UI part). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | chrome/browser/upgrade_detector_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ 5 #ifndef CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
6 #define CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ 6 #define CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "base/version.h" 10 #include "base/version.h"
11 #include "chrome/browser/upgrade_detector.h" 11 #include "chrome/browser/upgrade_detector.h"
12 12
13 template <typename T> struct DefaultSingletonTraits; 13 template <typename T> struct DefaultSingletonTraits;
14 14
15 class UpgradeDetectorImpl : public UpgradeDetector { 15 class UpgradeDetectorImpl : public UpgradeDetector {
16 public: 16 public:
17 virtual ~UpgradeDetectorImpl(); 17 virtual ~UpgradeDetectorImpl();
18 18
19 // Returns the currently installed Chrome version, which may be newer than the 19 // Returns the currently installed Chrome version, which may be newer than the
20 // one currently running. Not supported on Android, iOS or ChromeOS. Must be 20 // one currently running. Not supported on Android, iOS or ChromeOS. Must be
21 // run on a thread where I/O operations are allowed (e.g. FILE thread). 21 // run on a thread where I/O operations are allowed (e.g. FILE thread).
22 static base::Version GetCurrentlyInstalledVersion(); 22 static base::Version GetCurrentlyInstalledVersion();
23 23
24 // Returns the singleton instance. 24 // Returns the singleton instance.
25 static UpgradeDetectorImpl* GetInstance(); 25 static UpgradeDetectorImpl* GetInstance();
26 26
27 // Launches a task on the file thread to check if we have the latest version.
28 virtual void CheckForUpgrade() OVERRIDE;
29
27 private: 30 private:
28 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>; 31 friend struct DefaultSingletonTraits<UpgradeDetectorImpl>;
29 32
30 UpgradeDetectorImpl(); 33 UpgradeDetectorImpl();
31 34
32 // Start the timer that will call |CheckForUpgrade()|. 35 // Start the timer that will call |CheckForUpgrade()|.
33 void StartTimerForUpgradeCheck(); 36 void StartTimerForUpgradeCheck();
34 37
35 // Launches a task on the file thread to check if we have the latest version.
36 void CheckForUpgrade();
37
38 // Sends out a notification and starts a one shot timer to wait until 38 // Sends out a notification and starts a one shot timer to wait until
39 // notifying the user. 39 // notifying the user.
40 void UpgradeDetected(UpgradeAvailable upgrade_available); 40 void UpgradeStatusChanged(UpgradeAvailable upgrade_available);
41
42 static void NotifyNoUpgrade(
43 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector);
44
45 // Returns true after calling UpgradeDetected if elevation is needed to
46 // upgrade or fix broken Omaha/Chrome.
47 bool DetectElevationNeeded();
41 48
42 // Returns true after calling UpgradeDetected if current install is outdated. 49 // Returns true after calling UpgradeDetected if current install is outdated.
43 bool DetectOutdatedInstall(); 50 bool DetectOutdatedInstall();
44 51
45 // The function that sends out a notification (after a certain time has 52 // The function that sends out a notification (after a certain time has
46 // elapsed) that lets the rest of the UI know we should start notifying the 53 // elapsed) that lets the rest of the UI know we should start notifying the
47 // user that a new version is available. 54 // user that a new version is available.
48 void NotifyOnUpgrade(); 55 void NotifyUpgradeStatusChanged();
49 56
50 // Called on the FILE thread to detect an upgrade. Calls back UpgradeDetected 57 // Called on the FILE thread to detect an upgrade. Calls back UpgradeDetected
51 // on the UI thread if so. Although it looks weird, this needs to be a static 58 // on the UI thread if so. Although it looks weird, this needs to be a static
52 // method receiving a WeakPtr<> to this object so that we can interrupt 59 // method receiving a WeakPtr<> to this object so that we can interrupt
53 // the UpgradeDetected callback before it runs. Having this method non-static 60 // the UpgradeDetected callback before it runs. Having this method non-static
54 // and using |this| directly wouldn't be thread safe. And keeping it as a 61 // and using |this| directly wouldn't be thread safe. And keeping it as a
55 // non-class function would prevent it from calling UpgradeDetected. 62 // non-class function would prevent it from calling UpgradeDetected.
56 static void DetectUpgradeTask( 63 static void DetectUpgradeTask(
57 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector); 64 base::WeakPtr<UpgradeDetectorImpl> upgrade_detector);
58 65
(...skipping 16 matching lines...) Expand all
75 bool is_auto_update_enabled_; 82 bool is_auto_update_enabled_;
76 83
77 // The date the binaries were built. 84 // The date the binaries were built.
78 base::Time build_date_; 85 base::Time build_date_;
79 86
80 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl); 87 DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImpl);
81 }; 88 };
82 89
83 90
84 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_ 91 #endif // CHROME_BROWSER_UPGRADE_DETECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | chrome/browser/upgrade_detector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698