Commit 575a95d3 authored by tfarina@chromium.org's avatar tfarina@chromium.org

cros: Remove unneeded includes from update_library.h plus some random cleanups.

BUG=None
TEST=None

R=stevenjb@chromium.org

Review URL: http://codereview.chromium.org/7575001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95574 0039d316-1c4b-4281-b951-d872f2087c98
parent fc197211
......@@ -4,8 +4,9 @@
#include "chrome/browser/chromeos/cros/update_library.h"
#include "base/basictypes.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "content/browser/browser_thread.h"
......@@ -13,16 +14,15 @@ namespace chromeos {
class UpdateLibraryImpl : public UpdateLibrary {
public:
UpdateLibraryImpl()
: status_connection_(NULL) {
if (CrosLibrary::Get()->EnsureLoaded()) {
UpdateLibraryImpl() : status_connection_(NULL) {
if (CrosLibrary::Get()->EnsureLoaded())
Init();
}
}
virtual ~UpdateLibraryImpl() {
if (status_connection_) {
DisconnectUpdateProgress(status_connection_);
chromeos::DisconnectUpdateProgress(status_connection_);
status_connection_ = NULL;
}
}
......@@ -66,14 +66,13 @@ class UpdateLibraryImpl : public UpdateLibrary {
}
private:
static void ChangedHandler(void* object,
const UpdateProgress& status) {
UpdateLibraryImpl* updater = static_cast<UpdateLibraryImpl*>(object);
updater->UpdateStatus(Status(status));
static void ChangedHandler(void* object, const UpdateProgress& status) {
UpdateLibraryImpl* impl = static_cast<UpdateLibraryImpl*>(object);
impl->UpdateStatus(Status(status));
}
void Init() {
status_connection_ = MonitorUpdateStatus(&ChangedHandler, this);
status_connection_ = chromeos::MonitorUpdateStatus(&ChangedHandler, this);
// Asynchronously load the initial state.
RequestUpdateStatus(&ChangedHandler, this);
}
......
......@@ -8,9 +8,6 @@
#include <string>
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "base/time.h"
#include "third_party/cros/chromeos_update_engine.h"
namespace chromeos {
......@@ -33,19 +30,19 @@ class UpdateLibrary {
new_size(0) {
}
explicit Status(const UpdateProgress& x) :
status(x.status_),
download_progress(x.download_progress_),
last_checked_time(x.last_checked_time_),
new_version(x.new_version_),
new_size(x.new_size_) {
explicit Status(const UpdateProgress& o)
: status(o.status_),
download_progress(o.download_progress_),
last_checked_time(o.last_checked_time_),
new_version(o.new_version_),
new_size(o.new_size_) {
}
UpdateStatusOperation status;
double download_progress; // 0.0 - 1.0
double download_progress; // 0.0 - 1.0
int64_t last_checked_time; // As reported by std::time().
std::string new_version;
int64_t new_size; // Valid during DOWNLOADING, in bytes.
int64_t new_size; // Valid during DOWNLOADING, in bytes.
};
class Observer {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment