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

Side by Side Diff: chrome/browser/chromeos/cros/update_library.h

Issue 8637020: chromeos: Remove UpdateLibrary code, which is no longer used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_UPDATE_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_UPDATE_LIBRARY_H_
7 #pragma once
8
9 #include <string>
10
11 #include "third_party/cros/chromeos_update_engine.h"
12
13 namespace chromeos {
14
15 // This interface defines interaction with the ChromeOS update library APIs.
16 // Classes can add themselves as observers. Users can get an instance of this
17 // library class like this: chromeos::CrosLibrary::Get()->GetUpdateLibrary()
18 class UpdateLibrary {
19 public:
20 // TODO(seanparent): Should make the UpdateProgress type copyable.
21 // We need to copy it to bind it for a deferred notification.
22 // Modifying the cros library just for that, for a single use case,
23 // isn't worth it. Instead we define this a local Status struct that
24 // is copyable.
25 struct Status {
26 Status()
27 : status(UPDATE_STATUS_IDLE),
28 download_progress(0.0),
29 last_checked_time(0),
30 new_size(0) {
31 }
32
33 explicit Status(const UpdateProgress& o)
34 : status(o.status_),
35 download_progress(o.download_progress_),
36 last_checked_time(o.last_checked_time_),
37 new_version(o.new_version_),
38 new_size(o.new_size_) {
39 }
40
41 UpdateStatusOperation status;
42 double download_progress; // 0.0 - 1.0
43 int64_t last_checked_time; // As reported by std::time().
44 std::string new_version;
45 int64_t new_size; // Valid during DOWNLOADING, in bytes.
46 };
47
48 class Observer {
49 public:
50 virtual ~Observer() {}
51
52 virtual void UpdateStatusChanged(const Status& status) = 0;
53 };
54
55 virtual ~UpdateLibrary() {}
56
57 virtual void Init() = 0;
58
59 virtual void AddObserver(Observer* observer) = 0;
60 virtual void RemoveObserver(Observer* observer) = 0;
61 virtual bool HasObserver(Observer* observer) = 0;
62
63 // Requests an update check and calls |callback| when completed.
64 virtual void RequestUpdateCheck(chromeos::UpdateCallback callback,
65 void* user_data) = 0;
66
67 // Reboots if update has been performed.
68 virtual void RebootAfterUpdate() = 0;
69
70 // Sets the release track (channel). |track| should look like
71 // "beta-channel" and "dev-channel". Returns true on success.
72 virtual void SetReleaseTrack(const std::string& track) = 0;
73
74 // Calls |callback| with the release track (channel). On error, calls
75 // |callback| with NULL.
76 virtual void GetReleaseTrack(chromeos::UpdateTrackCallback callback,
77 void* user_data) = 0;
78
79 virtual const Status& status() const = 0;
80
81 // Factory function, creates a new instance and returns ownership.
82 // For normal usage, access the singleton via CrosLibrary::Get().
83 static UpdateLibrary* GetImpl(bool stub);
84 };
85
86 } // namespace chromeos
87
88 #endif // CHROME_BROWSER_CHROMEOS_CROS_UPDATE_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/mock_update_library.cc ('k') | chrome/browser/chromeos/cros/update_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698