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

Unified Diff: chrome/browser/chromeos/cros/burn_library.cc

Issue 7891021: Use stub impl when libcros fails to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix power manager stub impl Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/burn_library.cc
diff --git a/chrome/browser/chromeos/cros/burn_library.cc b/chrome/browser/chromeos/cros/burn_library.cc
index e45863c7d69217b44bdf7d04b1035b3fa79ef35d..62406e7be955bb5043ac3efc8cf76f680daa83c8 100644
--- a/chrome/browser/chromeos/cros/burn_library.cc
+++ b/chrome/browser/chromeos/cros/burn_library.cc
@@ -88,11 +88,6 @@ BurnLibraryImpl::BurnLibraryImpl() : unzipping_(false),
cancelled_(false),
burning_(false),
block_burn_signals_(false) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
- Init();
- } else {
- LOG(ERROR) << "Cros Library has not been loaded";
- }
}
BurnLibraryImpl::~BurnLibraryImpl() {
@@ -102,7 +97,9 @@ BurnLibraryImpl::~BurnLibraryImpl() {
}
void BurnLibraryImpl::Init() {
- burn_status_connection_ = MonitorBurnStatus(&BurnStatusChangedHandler, this);
+ DCHECK(CrosLibrary::Get()->libcros_loaded());
+ burn_status_connection_ =
+ chromeos::MonitorBurnStatus(&BurnStatusChangedHandler, this);
}
void BurnLibraryImpl::AddObserver(Observer* observer) {
@@ -254,6 +251,7 @@ class BurnLibraryStubImpl : public BurnLibrary {
virtual ~BurnLibraryStubImpl() {}
// BurnLibrary overrides.
+ virtual void Init() OVERRIDE {}
virtual void AddObserver(Observer* observer) OVERRIDE {}
virtual void RemoveObserver(Observer* observer) OVERRIDE {}
virtual void DoBurn(const FilePath& source_path,
@@ -268,10 +266,13 @@ class BurnLibraryStubImpl : public BurnLibrary {
// static
BurnLibrary* BurnLibrary::GetImpl(bool stub) {
+ BurnLibrary* impl;
if (stub)
- return new BurnLibraryStubImpl();
+ impl = new BurnLibraryStubImpl();
else
- return new BurnLibraryImpl();
+ impl = new BurnLibraryImpl();
+ impl->Init();
+ return impl;
}
} // namespace chromeos
@@ -279,4 +280,3 @@ BurnLibrary* BurnLibrary::GetImpl(bool stub) {
// Allows InvokeLater without adding refcounting. This class is a Singleton and
// won't be deleted until it's last InvokeLater is run.
DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::BurnLibraryImpl);
-

Powered by Google App Engine
This is Rietveld 408576698