Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chromeos / disks / suspend_unmount_manager.h
blobb52687c7d35c6edcd45286b2f5595109e0762f0a
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DISKS_SUSPEND_UNMOUNT_MANAGER_H_
6 #define CHROMEOS_DISKS_SUSPEND_UNMOUNT_MANAGER_H_
8 #include <set>
9 #include <string>
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/cros_disks_client.h"
13 #include "chromeos/dbus/power_manager_client.h"
15 namespace chromeos {
16 namespace disks {
18 class DiskMountManager;
20 // Class to unmount disks at suspend.
21 class CHROMEOS_EXPORT SuspendUnmountManager
22 : public PowerManagerClient::Observer {
23 public:
24 // The ownership of these raw pointers still remains with the caller.
25 SuspendUnmountManager(DiskMountManager* disk_mount_manager,
26 PowerManagerClient* power_manager_client);
27 ~SuspendUnmountManager() override;
29 private:
30 void OnUnmountComplete(const std::string& mount_path,
31 chromeos::MountError error_code);
33 // PowerManagerClient::Observer
34 void SuspendImminent() override;
35 void SuspendDone(const base::TimeDelta& sleep_duration) override;
37 // Callback passed to DiskMountManager holds weak pointers of this.
38 DiskMountManager* const disk_mount_manager_;
39 PowerManagerClient* const power_manager_client_;
41 // The paths that the manager currently tries to unmount for suspend.
42 std::set<std::string> unmounting_paths_;
44 base::Closure suspend_readiness_callback_;
46 base::WeakPtrFactory<SuspendUnmountManager> weak_ptr_factory_;
48 DISALLOW_COPY_AND_ASSIGN(SuspendUnmountManager);
51 } // namespace disks
52 } // namespace chromeos
54 #endif // CHROMEOS_DISKS_SUSPEND_UNMOUNT_MANAGER_H_