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

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

Issue 1142005: Mocks for all libcros elements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/browser/chromeos/cros/mount_library.h ('k') | chrome/browser/chromeos/cros/network_library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/mount_library.cc
===================================================================
--- chrome/browser/chromeos/cros/mount_library.cc (revision 42341)
+++ chrome/browser/chromeos/cros/mount_library.cc (working copy)
@@ -12,27 +12,22 @@
// Allows InvokeLater without adding refcounting. This class is a Singleton and
// won't be deleted until it's last InvokeLater is run.
template <>
-struct RunnableMethodTraits<chromeos::MountLibrary> {
- void RetainCallee(chromeos::MountLibrary* obj) {}
- void ReleaseCallee(chromeos::MountLibrary* obj) {}
+struct RunnableMethodTraits<chromeos::MountLibraryImpl> {
+ void RetainCallee(chromeos::MountLibraryImpl* obj) {}
+ void ReleaseCallee(chromeos::MountLibraryImpl* obj) {}
};
namespace chromeos {
-// static
-MountLibrary* MountLibrary::Get() {
- return Singleton<MountLibrary>::get();
-}
-
-void MountLibrary::AddObserver(Observer* observer) {
+void MountLibraryImpl::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
-void MountLibrary::RemoveObserver(Observer* observer) {
+void MountLibraryImpl::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
-void MountLibrary::ParseDisks(const MountStatus& status) {
+void MountLibraryImpl::ParseDisks(const MountStatus& status) {
disks_.clear();
for (int i = 0; i < status.size; i++) {
std::string path;
@@ -51,32 +46,32 @@
}
}
-MountLibrary::MountLibrary() {
- if (CrosLibrary::EnsureLoaded()) {
+MountLibraryImpl::MountLibraryImpl() : mount_status_connection_(NULL) {
+ if (CrosLibrary::Get()->EnsureLoaded()) {
Init();
} else {
LOG(ERROR) << "Cros Library has not been loaded";
}
}
-MountLibrary::~MountLibrary() {
- if (CrosLibrary::EnsureLoaded()) {
+MountLibraryImpl::~MountLibraryImpl() {
+ if (mount_status_connection_) {
DisconnectMountStatus(mount_status_connection_);
}
}
// static
-void MountLibrary::MountStatusChangedHandler(void* object,
+void MountLibraryImpl::MountStatusChangedHandler(void* object,
const MountStatus& status,
MountEventType evt,
const char* path) {
- MountLibrary* mount = static_cast<MountLibrary*>(object);
+ MountLibraryImpl* mount = static_cast<MountLibraryImpl*>(object);
std::string devicepath = path;
mount->ParseDisks(status);
mount->UpdateMountStatus(status, evt, devicepath);
}
-void MountLibrary::Init() {
+void MountLibraryImpl::Init() {
// Getting the monitor status so that the daemon starts up.
MountStatus* mount = RetrieveMountInformation();
FreeMountStatus(mount);
@@ -85,7 +80,7 @@
&MountStatusChangedHandler, this);
}
-void MountLibrary::UpdateMountStatus(const MountStatus& status,
+void MountLibraryImpl::UpdateMountStatus(const MountStatus& status,
MountEventType evt,
const std::string& path) {
// Make sure we run on UI thread.
« no previous file with comments | « chrome/browser/chromeos/cros/mount_library.h ('k') | chrome/browser/chromeos/cros/network_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698