summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-08 23:39:00 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-08 23:39:00 +0000
commit7291c4878d7afa5e575084d8fae75b58c11a8262 (patch)
treef4aef6874f0a8d6d91850242781248db2d26b41e /chrome/browser/chromeos
parent1339dd165d3d248289c2400d34bf0eadfd013a2f (diff)
downloadchromium_src-7291c4878d7afa5e575084d8fae75b58c11a8262.zip
chromium_src-7291c4878d7afa5e575084d8fae75b58c11a8262.tar.gz
chromium_src-7291c4878d7afa5e575084d8fae75b58c11a8262.tar.bz2
Revert 94812 - Formatting feature initial commit for ChromeOS Tree
Reverting to make merging next patch into M14 easier. Added formatting API for browser extension as well as event routing. Created a complete UI for formatting. This code depends on the following changes to libcros: http://gerrit.chromium.org/gerrit/#change,4446 BUG=chromium-os:4541, chromium-os:17071 TEST=Try to format removable media. Review URL: http://codereview.chromium.org/7471024 TBR=sidor@chromium.org Review URL: http://codereview.chromium.org/7599015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/cros/mock_mount_library.cc4
-rw-r--r--chrome/browser/chromeos/cros/mock_mount_library.h2
-rw-r--r--chrome/browser/chromeos/cros/mount_library.cc105
-rw-r--r--chrome/browser/chromeos/cros/mount_library.h13
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_event_router.cc175
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_event_router.h25
6 files changed, 68 insertions, 256 deletions
diff --git a/chrome/browser/chromeos/cros/mock_mount_library.cc b/chrome/browser/chromeos/cros/mock_mount_library.cc
index d87abfe..889522d 100644
--- a/chrome/browser/chromeos/cros/mock_mount_library.cc
+++ b/chrome/browser/chromeos/cros/mock_mount_library.cc
@@ -132,10 +132,6 @@ void MockMountLibrary::SetupDefaultReplies() {
.Times(AnyNumber());
EXPECT_CALL(*this, UnmountPath(_))
.Times(AnyNumber());
- EXPECT_CALL(*this, FormatUnmountedDevice(_))
- .Times(AnyNumber());
- EXPECT_CALL(*this, FormatMountedDevice(_))
- .Times(AnyNumber());
EXPECT_CALL(*this, UnmountDeviceRecursive(_, _, _))
.Times(AnyNumber());
}
diff --git a/chrome/browser/chromeos/cros/mock_mount_library.h b/chrome/browser/chromeos/cros/mock_mount_library.h
index 020849f..5965f2c 100644
--- a/chrome/browser/chromeos/cros/mock_mount_library.h
+++ b/chrome/browser/chromeos/cros/mock_mount_library.h
@@ -31,8 +31,6 @@ class MockMountLibrary : public MountLibrary {
MOCK_METHOD3(MountPath, void(const char*, MountType,
const MountPathOptions&));
MOCK_METHOD1(UnmountPath, void(const char*));
- MOCK_METHOD1(FormatUnmountedDevice, void(const char*));
- MOCK_METHOD1(FormatMountedDevice, void(const char*));
MOCK_METHOD3(UnmountDeviceRecursive, void(const char*,
MountLibrary::UnmountDeviceRecursiveCallbackType, void*));
diff --git a/chrome/browser/chromeos/cros/mount_library.cc b/chrome/browser/chromeos/cros/mount_library.cc
index c63ab48..f740b7c 100644
--- a/chrome/browser/chromeos/cros/mount_library.cc
+++ b/chrome/browser/chromeos/cros/mount_library.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/chromeos/cros/mount_library.h"
#include <set>
-#include <vector>
#include "base/message_loop.h"
#include "base/string_util.h"
@@ -145,62 +144,6 @@ class MountLibraryImpl : public MountLibrary {
UnmountMountPoint(path, &MountLibraryImpl::UnmountMountPointCallback, this);
}
- virtual void FormatUnmountedDevice(const char* file_path) OVERRIDE {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!CrosLibrary::Get()->EnsureLoaded()) {
- OnFormatDevice(file_path,
- false,
- MOUNT_METHOD_ERROR_LOCAL,
- kLibraryNotLoaded);
- return;
- }
- for (MountLibrary::DiskMap::iterator it = disks_.begin();
- it != disks_.end(); ++it) {
- if (it->second->file_path().compare(file_path) == 0 &&
- !it->second->mount_path().empty()) {
- OnFormatDevice(file_path,
- false,
- MOUNT_METHOD_ERROR_LOCAL,
- "Device is still mounted.");
- return;
- }
- }
- FormatDevice(file_path,
- "vfat", // currently format in vfat by default
- &MountLibraryImpl::FormatDeviceCallback,
- this);
- }
-
- virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {
- DCHECK(mount_path);
- std::string device_path, file_path;
- for (MountLibrary::DiskMap::iterator it = disks_.begin();
- it != disks_.end(); ++it) {
- if (it->second->mount_path().compare(mount_path) == 0) {
- device_path = it->second->device_path();
- file_path = it->second->file_path();
- break;
- }
- }
- if (device_path.empty()) {
- OnFormatDevice(device_path.c_str(),
- false,
- MOUNT_METHOD_ERROR_LOCAL,
- "Device with this mount path not found.");
- return;
- }
- if (formatting_pending_.find(device_path) != formatting_pending_.end()) {
- OnFormatDevice(device_path.c_str(),
- false,
- MOUNT_METHOD_ERROR_LOCAL,
- "Formatting is already pending.");
- return;
- }
- // Formatting process continues, after unmounting.
- formatting_pending_[device_path] = file_path;
- UnmountPath(device_path.c_str());
- }
-
virtual void UnmountDeviceRecursive(const char* device_path,
UnmountDeviceRecursiveCallbackType callback, void* user_data)
OVERRIDE {
@@ -288,17 +231,6 @@ class MountLibraryImpl : public MountLibrary {
self->OnUnmountPath(device_path, error, error_message);
}
- // Callback for FormatRemovableDevice method.
- static void FormatDeviceCallback(void* object,
- const char* device_path,
- bool success,
- MountMethodErrorType error,
- const char* error_message) {
- DCHECK(object);
- MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object);
- self->OnFormatDevice(device_path, success, error, error_message);
- }
-
// Callback for UnmountDeviceRecursive.
static void UnmountDeviceRecursiveCallback(void* object,
const char* device_path,
@@ -316,7 +248,7 @@ class MountLibraryImpl : public MountLibrary {
cb_data->success = false;
} else if (error == MOUNT_METHOD_ERROR_NONE) {
LOG(WARNING) << device_path << " unmounted.";
- }
+ }
// This is safe as long as all callbacks are called on the same thread as
// UnmountDeviceRecursive.
@@ -426,13 +358,6 @@ class MountLibraryImpl : public MountLibrary {
DCHECK(disk);
disk->clear_mount_path();
FireDiskStatusUpdate(MOUNT_DISK_UNMOUNTED, disk);
- // Check if there is a formatting scheduled
- PathMap::iterator it = formatting_pending_.find(source_path);
- if (it != formatting_pending_.end()) {
- const std::string file_path = it->second;
- formatting_pending_.erase(it);
- FormatUnmountedDevice(file_path.c_str());
- }
} else {
LOG(WARNING) << "Unmount request failed for device "
<< source_path << ", with error: "
@@ -440,24 +365,6 @@ class MountLibraryImpl : public MountLibrary {
}
}
- void OnFormatDevice(const char* device_path,
- bool success,
- MountMethodErrorType error,
- const char* error_message) {
- DCHECK(device_path);
-
- if (error == MOUNT_METHOD_ERROR_NONE && device_path && success) {
- FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED, device_path);
- } else {
- FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED,
- std::string("!") + device_path);
- LOG(WARNING) << "Format request failed for device "
- << device_path << ", with error: "
- << (error_message ? error_message : "Unknown");
- }
- }
-
-
void OnGetDiskProperties(const char* device_path,
const DiskInfo* disk1,
MountMethodErrorType error,
@@ -613,10 +520,6 @@ class MountLibraryImpl : public MountLibrary {
type = MOUNT_DEVICE_SCANNED;
break;
}
- case FORMATTING_FINISHED: {
- type = MOUNT_FORMATTING_FINISHED;
- break;
- }
default: {
return;
}
@@ -668,10 +571,6 @@ class MountLibraryImpl : public MountLibrary {
MountLibrary::DiskMap disks_;
MountLibrary::MountPointMap mount_points_;
- // Set of devices that are supposed to be formated, but are currently waiting
- // to be unmounted. When device is in this map, the formatting process HAVEN'T
- // started yet.
- PathMap formatting_pending_;
DISALLOW_COPY_AND_ASSIGN(MountLibraryImpl);
};
@@ -692,8 +591,6 @@ class MountLibraryStubImpl : public MountLibrary {
virtual void MountPath(const char* source_path, MountType type,
const MountPathOptions& options) OVERRIDE {}
virtual void UnmountPath(const char* path) OVERRIDE {}
- virtual void FormatUnmountedDevice(const char* device_path) OVERRIDE {}
- virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {}
virtual void UnmountDeviceRecursive(const char* device_path,
UnmountDeviceRecursiveCallbackType callback, void* user_data)
OVERRIDE {}
diff --git a/chrome/browser/chromeos/cros/mount_library.h b/chrome/browser/chromeos/cros/mount_library.h
index 061ba22..8be7a8a 100644
--- a/chrome/browser/chromeos/cros/mount_library.h
+++ b/chrome/browser/chromeos/cros/mount_library.h
@@ -24,9 +24,7 @@ typedef enum MountLibraryEventType {
MOUNT_DISK_UNMOUNTED,
MOUNT_DEVICE_ADDED,
MOUNT_DEVICE_REMOVED,
- MOUNT_DEVICE_SCANNED,
- MOUNT_FORMATTING_STARTED,
- MOUNT_FORMATTING_FINISHED
+ MOUNT_DEVICE_SCANNED
} MountLibraryEventType;
// This class handles the interaction with the ChromeOS mount library APIs.
@@ -102,7 +100,6 @@ class MountLibrary {
bool on_boot_device_;
};
typedef std::map<std::string, Disk*> DiskMap;
- typedef std::map<std::string, std::string> PathMap;
// MountPointInfo: {mount_path, mount_type}.
struct MountPointInfo {
@@ -148,14 +145,6 @@ class MountLibrary {
// |path| may be source od mount path.
virtual void UnmountPath(const char* path) = 0;
- // Formats device given its file path.
- // Example: file_path: /dev/sdb1
- virtual void FormatUnmountedDevice(const char* file_path) = 0;
-
- // Formats Device given its mount path. Unmount's the device
- // Example: mount_path: /media/VOLUME_LABEL
- virtual void FormatMountedDevice(const char* mount_path) = 0;
-
// Unmounts device_poath and all of its known children.
virtual void UnmountDeviceRecursive(const char* device_path,
UnmountDeviceRecursiveCallbackType callback, void* user_data) = 0;
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
index dfb1b84..91df6b3 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -4,10 +4,7 @@
#include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
-#include "base/bind.h"
#include "base/json/json_writer.h"
-#include "base/memory/singleton.h"
-#include "base/message_loop.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
@@ -25,38 +22,24 @@
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h"
-namespace {
- const char kDiskAddedEventType[] = "added";
- const char kDiskRemovedEventType[] = "removed";
-
- const char kPathChanged[] = "changed";
- const char kPathWatchError[] = "error";
-
- const char* DeviceTypeToString(chromeos::DeviceType type) {
- switch (type) {
- case chromeos::FLASH:
- return "flash";
- case chromeos::HDD:
- return "hdd";
- case chromeos::OPTICAL:
- return "optical";
- default:
- break;
- }
- return "undefined";
- }
+const char kDiskAddedEventType[] = "added";
+const char kDiskRemovedEventType[] = "removed";
- DictionaryValue* DiskToDictionaryValue(
- const chromeos::MountLibrary::Disk* disk) {
- DictionaryValue* result = new DictionaryValue();
- result->SetString("mountPath", disk->mount_path());
- result->SetString("devicePath", disk->device_path());
- result->SetString("label", disk->device_label());
- result->SetString("deviceType", DeviceTypeToString(disk->device_type()));
- result->SetInteger("totalSizeKB", disk->total_size() / 1024);
- result->SetBoolean("readOnly", disk->is_read_only());
- return result;
+const char kPathChanged[] = "changed";
+const char kPathWatchError[] = "error";
+
+const char* DeviceTypeToString(chromeos::DeviceType type) {
+ switch (type) {
+ case chromeos::FLASH:
+ return "flash";
+ case chromeos::HDD:
+ return "hdd";
+ case chromeos::OPTICAL:
+ return "optical";
+ default:
+ break;
}
+ return "undefined";
}
const char* MountErrorToString(chromeos::MountError error) {
@@ -81,9 +64,16 @@ const char* MountErrorToString(chromeos::MountError error) {
return "";
}
-void HideFileBrowserNotificationExternally(const std::string& category,
- const std::string& system_path, ExtensionFileBrowserEventRouter* that) {
- that->HideFileBrowserNotification(category, system_path);
+DictionaryValue* DiskToDictionaryValue(
+ const chromeos::MountLibrary::Disk* disk) {
+ DictionaryValue* result = new DictionaryValue();
+ result->SetString("mountPath", disk->mount_path());
+ result->SetString("devicePath", disk->device_path());
+ result->SetString("label", disk->device_label());
+ result->SetString("deviceType", DeviceTypeToString(disk->device_type()));
+ result->SetInteger("totalSizeKB", disk->total_size() / 1024);
+ result->SetBoolean("readOnly", disk->is_read_only());
+ return result;
}
ExtensionFileBrowserEventRouter::ExtensionFileBrowserEventRouter(
@@ -182,10 +172,6 @@ void ExtensionFileBrowserEventRouter::DeviceChanged(
OnDeviceRemoved(device_path);
} else if (event == chromeos::MOUNT_DEVICE_SCANNED) {
OnDeviceScanned(device_path);
- } else if (event == chromeos::MOUNT_FORMATTING_STARTED) {
- OnFormattingStarted(device_path);
- } else if (event == chromeos::MOUNT_FORMATTING_FINISHED) {
- OnFormattingFinished(device_path);
}
}
void ExtensionFileBrowserEventRouter::MountCompleted(
@@ -321,7 +307,7 @@ void ExtensionFileBrowserEventRouter::OnDiskAdded(
}
if (disk->is_parent()) {
if (!disk->has_media()) {
- HideFileBrowserNotification("MOUNT", disk->system_path());
+ HideDeviceNotification(disk->system_path());
return;
}
}
@@ -335,13 +321,12 @@ void ExtensionFileBrowserEventRouter::OnDiskAdded(
chromeos::MOUNT_TYPE_DEVICE,
chromeos::MountPathOptions()); // Unused.
}
- DispatchMountEvent(disk, true);
}
void ExtensionFileBrowserEventRouter::OnDiskRemoved(
const chromeos::MountLibrary::Disk* disk) {
VLOG(1) << "Disk removed: " << disk->device_path();
- HideFileBrowserNotification("MOUNT", disk->system_path());
+ HideDeviceNotification(disk->system_path());
MountPointMap::iterator iter = mounted_devices_.find(disk->device_path());
if (iter == mounted_devices_.end())
return;
@@ -351,6 +336,7 @@ void ExtensionFileBrowserEventRouter::OnDiskRemoved(
// TODO(zelidrag): This for some reason does not work as advertized.
// we might need to clean up mount directory on FILE thread here as well.
lib->UnmountPath(disk->device_path().c_str());
+
DispatchMountEvent(disk, false);
mounted_devices_.erase(iter);
}
@@ -359,14 +345,14 @@ void ExtensionFileBrowserEventRouter::OnDiskChanged(
const chromeos::MountLibrary::Disk* disk) {
VLOG(1) << "Disk changed : " << disk->device_path();
if (!disk->mount_path().empty()) {
- HideFileBrowserNotification("MOUNT", disk->system_path());
+ HideDeviceNotification(disk->system_path());
// Remember this mount point.
if (mounted_devices_.find(disk->device_path()) == mounted_devices_.end()) {
mounted_devices_.insert(
std::pair<std::string, std::string>(disk->device_path(),
disk->mount_path()));
DispatchMountEvent(disk, true);
- HideFileBrowserNotification("MOUNT", disk->system_path());
+ HideDeviceNotification(disk->system_path());
FileManagerUtil::ShowFullTabUrl(profile_, FilePath(disk->mount_path()));
}
}
@@ -376,14 +362,14 @@ void ExtensionFileBrowserEventRouter::OnDeviceAdded(
const std::string& device_path) {
VLOG(1) << "Device added : " << device_path;
// TODO(zelidrag): Find better icon here.
- ShowFileBrowserNotification("MOUNT", device_path, IDR_PAGEINFO_INFO,
- l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE),
+ ShowDeviceNotification(device_path, IDR_PAGEINFO_INFO,
l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_SCANNING_MESSAGE));
+
}
void ExtensionFileBrowserEventRouter::OnDeviceRemoved(
const std::string& system_path) {
- HideFileBrowserNotification("MOUNT", system_path);
+ HideDeviceNotification(system_path);
}
void ExtensionFileBrowserEventRouter::OnDeviceScanned(
@@ -391,74 +377,33 @@ void ExtensionFileBrowserEventRouter::OnDeviceScanned(
VLOG(1) << "Device scanned : " << device_path;
}
-void ExtensionFileBrowserEventRouter::OnFormattingStarted(
- const std::string& device_path) {
- if (device_path[0] == '!') {
- ShowFileBrowserNotification("FORMAT_FINISHED", device_path.substr(1),
- IDR_PAGEINFO_WARNING_MAJOR,
- l10n_util::GetStringUTF16(IDS_FORMATTING_OF_DEVICE_FINISHED_TITLE),
- l10n_util::GetStringUTF16(IDS_FORMATTING_STARTED_FAILURE_MESSAGE));
- } else {
- ShowFileBrowserNotification("FORMAT", device_path, IDR_PAGEINFO_INFO,
- l10n_util::GetStringUTF16(IDS_FORMATTING_OF_DEVICE_PENDING_TITLE),
- l10n_util::GetStringUTF16(IDS_FORMATTING_OF_DEVICE_PENDING_MESSAGE));
- }
-}
-
-void ExtensionFileBrowserEventRouter::OnFormattingFinished(
- const std::string& device_path) {
- if (device_path[0] == '!') {
- HideFileBrowserNotification("FORMAT", device_path.substr(1));
- ShowFileBrowserNotification("FORMAT_FINISHED", device_path.substr(1),
- IDR_PAGEINFO_WARNING_MAJOR,
- l10n_util::GetStringUTF16(IDS_FORMATTING_OF_DEVICE_FINISHED_TITLE),
- l10n_util::GetStringUTF16(IDS_FORMATTING_FINISHED_FAILURE_MESSAGE));
+void ExtensionFileBrowserEventRouter::ShowDeviceNotification(
+ const std::string& system_path, int icon_resource_id,
+ const string16& message) {
+ NotificationMap::iterator iter = FindNotificationForPath(system_path);
+ std::string mount_path;
+ if (iter != notifications_.end()) {
+ iter->second->Show(message, false, false);
} else {
- HideFileBrowserNotification("FORMAT", device_path);
- ShowFileBrowserNotification("FORMAT_FINISHED", device_path,
- IDR_PAGEINFO_INFO,
- l10n_util::GetStringUTF16(IDS_FORMATTING_OF_DEVICE_FINISHED_TITLE),
- l10n_util::GetStringUTF16(IDS_FORMATTING_FINISHED_SUCCESS_MESSAGE));
- // Hide it after a couple of seconds
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- base::Bind(&HideFileBrowserNotificationExternally, "FORMAT_FINISHED",
- device_path, this),
- 4000);
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
- lib->MountPath(device_path.c_str(),
- chromeos::MOUNT_TYPE_DEVICE,
- chromeos::MountPathOptions());
- }
-}
-
-void ExtensionFileBrowserEventRouter::ShowFileBrowserNotification(
- const std::string& category, const std::string& system_path,
- int icon_resource_id, const string16& title, const string16& message) {
- std::string notification_id = category + system_path;
- // New notification always created because, it might have been closed by now.
- NotificationMap::iterator iter = FindNotificationForId(notification_id);
- if (iter != notifications_.end())
- notifications_.erase(iter);
- if (!profile_) {
- NOTREACHED();
- return;
+ if (!profile_) {
+ NOTREACHED();
+ return;
+ }
+ chromeos::SystemNotification* notification =
+ new chromeos::SystemNotification(
+ profile_,
+ system_path,
+ icon_resource_id,
+ l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE));
+ notifications_.insert(NotificationMap::value_type(system_path,
+ linked_ptr<chromeos::SystemNotification>(notification)));
+ notification->Show(message, false, false);
}
- chromeos::SystemNotification* notification =
- new chromeos::SystemNotification(
- profile_,
- notification_id,
- icon_resource_id,
- title);
- notifications_.insert(NotificationMap::value_type(notification_id,
- linked_ptr<chromeos::SystemNotification>(notification)));
- notification->Show(message, false, false);
}
-void ExtensionFileBrowserEventRouter::HideFileBrowserNotification(
- const std::string& category, const std::string& system_path) {
- NotificationMap::iterator iter = FindNotificationForId(
- category + system_path);
+void ExtensionFileBrowserEventRouter::HideDeviceNotification(
+ const std::string& system_path) {
+ NotificationMap::iterator iter = FindNotificationForPath(system_path);
if (iter != notifications_.end()) {
iter->second->Hide();
notifications_.erase(iter);
@@ -466,15 +411,15 @@ void ExtensionFileBrowserEventRouter::HideFileBrowserNotification(
}
ExtensionFileBrowserEventRouter::NotificationMap::iterator
- ExtensionFileBrowserEventRouter::FindNotificationForId(
- const std::string& notification_id) {
+ ExtensionFileBrowserEventRouter::FindNotificationForPath(
+ const std::string& system_path) {
for (NotificationMap::iterator iter = notifications_.begin();
iter != notifications_.end();
++iter) {
const std::string& notification_device_path = iter->first;
// Doing a sub string match so that we find if this new one is a subdevice
// of another already inserted device.
- if (StartsWithASCII(notification_id, notification_device_path, true)) {
+ if (StartsWithASCII(system_path, notification_device_path, true)) {
return iter;
}
}
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h
index 8355649..ebc7f6c 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.h
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h
@@ -27,11 +27,6 @@ class SystemNotification;
// found.
class ExtensionFileBrowserEventRouter
: public chromeos::MountLibrary::Observer {
-
- friend void HideFileBrowserNotificationExternally(
- const std::string& category, const std::string& system_path,
- ExtensionFileBrowserEventRouter* that);
-
public:
explicit ExtensionFileBrowserEventRouter(Profile* profile);
virtual ~ExtensionFileBrowserEventRouter();
@@ -61,8 +56,7 @@ class ExtensionFileBrowserEventRouter
NotificationMap;
typedef std::map<std::string, std::string> MountPointMap;
typedef struct FileWatcherExtensions {
- FileWatcherExtensions(const FilePath& path,
- const std::string& extension_id) {
+ FileWatcherExtensions(const FilePath& path, const std::string& extension_id) {
file_watcher.reset(new base::files::FilePathWatcher());
virtual_path = path;
extensions.insert(extension_id);
@@ -94,17 +88,13 @@ class ExtensionFileBrowserEventRouter
void OnDiskAdded(const chromeos::MountLibrary::Disk* disk);
void OnDiskRemoved(const chromeos::MountLibrary::Disk* disk);
void OnDiskChanged(const chromeos::MountLibrary::Disk* disk);
- void OnDiskMounted(const chromeos::MountLibrary::Disk* disk);
- void OnDiskUnmounted(const chromeos::MountLibrary::Disk* disk);
void OnDeviceAdded(const std::string& device_path);
void OnDeviceRemoved(const std::string& device_path);
void OnDeviceScanned(const std::string& device_path);
- void OnFormattingStarted(const std::string& device_path);
- void OnFormattingFinished(const std::string& device_path);
// Finds first notifications corresponding to the same device. Ensures that
// we don't pop up multiple notifications for the same device.
- NotificationMap::iterator FindNotificationForId(const std::string& path);
+ NotificationMap::iterator FindNotificationForPath(const std::string& path);
// Process file watch notifications.
void HandleFileWatchNotification(const FilePath& path,
@@ -130,13 +120,10 @@ class ExtensionFileBrowserEventRouter
bool small);
// Show/hide desktop notifications.
- void ShowFileBrowserNotification(const std::string& category,
- const std::string& system_path,
- int icon_resource_id,
- const string16& title,
- const string16& message);
- void HideFileBrowserNotification(const std::string& category,
- const std::string& system_path);
+ void ShowDeviceNotification(const std::string& system_path,
+ int icon_resource_id,
+ const string16& message);
+ void HideDeviceNotification(const std::string& system_path);
scoped_refptr<FileWatcherDelegate> delegate_;
MountPointMap mounted_devices_;