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

Unified Diff: chrome/browser/chromeos/file_manager/mounted_disk_monitor.h

Issue 479563007: Files.app: Remove MountedDiskMonitor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 4 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/file_manager/mounted_disk_monitor.h
diff --git a/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h b/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
deleted file mode 100644
index ebaac2c36d631aded488c88228b7d2aa7c5e02b3..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_MOUNTED_DISK_MONITOR_H_
-#define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_MOUNTED_DISK_MONITOR_H_
-
-#include <map>
-#include <set>
-#include <string>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "chromeos/disks/disk_mount_manager.h"
-
-namespace file_manager {
-
-// Observes PowerManager and updates its state when the system suspends and
-// resumes. After the system resumes it will stay in "is_resuming" state for
-// couple of seconds. This is to give DiskManager time to process device
-// removed/added events (events for the devices that were present before suspend
-// should not trigger any new notifications or file manager windows).
-class MountedDiskMonitor : public chromeos::PowerManagerClient::Observer {
- public:
- explicit MountedDiskMonitor(
- chromeos::PowerManagerClient* power_manager_client);
- virtual ~MountedDiskMonitor();
-
- // PowerManagerClient::Observer overrides:
- virtual void SuspendImminent() OVERRIDE;
- virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE;
-
- // Receives forwarded notifications originates from DiskMountManager.
- void OnDiskEvent(
- chromeos::disks::DiskMountManager::DiskEvent event,
- const chromeos::disks::DiskMountManager::Disk* disk);
- void OnDeviceEvent(
- chromeos::disks::DiskMountManager::DeviceEvent event,
- const std::string& device_path);
- void OnMountEvent(
- chromeos::disks::DiskMountManager::MountEvent event,
- chromeos::MountError error_code,
- const chromeos::disks::DiskMountManager::MountPointInfo& mount_info,
- const chromeos::disks::DiskMountManager::Disk* disk);
-
- // Checks if the disk is being remounted. The disk is remounting if it has
- // been unmounted during the resuming time span.
- bool DiskIsRemounting(
- const chromeos::disks::DiskMountManager::Disk& disk) const;
- bool DeviceIsHardUnpluggedButNotReported(
- const std::string& device_path) const;
- void MarkAsHardUnpluggedReported(const std::string& device_path);
-
- // In order to avoid consuming time a lot for testing, this allows to set the
- // resuming time span.
- void set_resuming_time_span_for_testing(
- const base::TimeDelta& resuming_time_span) {
- resuming_time_span_ = resuming_time_span;
- }
-
- private:
- enum HardUnpluggedState { HARD_UNPLUGGED, HARD_UNPLUGGED_AND_REPORTED };
- // Maps source paths with corresponding uuids.
- typedef std::map<std::string, std::string> DiskMap;
-
- // Set of uuids.
- typedef std::set<std::string> DiskSet;
-
- void Reset();
-
- chromeos::PowerManagerClient* power_manager_client_;
-
- bool is_resuming_;
- DiskMap mounted_disks_;
- DiskSet unmounted_while_resuming_;
- // Set of device path that is hard unplugged.
- std::map<std::string, HardUnpluggedState> hard_unplugged_;
- base::TimeDelta resuming_time_span_;
- base::WeakPtrFactory<MountedDiskMonitor> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(MountedDiskMonitor);
-};
-
-} // namespace file_manager
-
-#endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_MOUNTED_DISK_MONITOR_H_

Powered by Google App Engine
This is Rietveld 408576698