volume_manager_observer.h revision 0529e5d033099cbfc42635f6f6183833b09dff6e
1// Copyright 2013 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.
4
5#ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_OBSERVER_H_
6#define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_OBSERVER_H_
7
8#include <string>
9
10#include "chromeos/dbus/cros_disks_client.h"
11#include "chromeos/disks/disk_mount_manager.h"
12
13namespace file_manager {
14
15struct VolumeInfo;
16
17// Observer interface of volume related events.
18class VolumeManagerObserver {
19 public:
20  virtual ~VolumeManagerObserver() {}
21
22  // Fired when a new disk is added.
23  virtual void OnDiskAdded(
24      const chromeos::disks::DiskMountManager::Disk& disk, bool mounting) = 0;
25
26  // Fired when a disk is removed.
27  virtual void OnDiskRemoved(
28      const chromeos::disks::DiskMountManager::Disk& disk) = 0;
29
30  // Fired when a new device is added.
31  virtual void OnDeviceAdded(const std::string& device_path) = 0;
32
33  // Fired when a device is removed.
34  virtual void OnDeviceRemoved(const std::string& device_path,
35                               bool hard_unplugged) = 0;
36
37  // Fired when a volume is mounted.
38  virtual void OnVolumeMounted(chromeos::MountError error_code,
39                               const VolumeInfo& volume_info,
40                               bool is_remounting) = 0;
41
42  // Fired when a volume is unmounted.
43  virtual void OnVolumeUnmounted(chromeos::MountError error_code,
44                                 const VolumeInfo& volume_info) = 0;
45
46  // Fired when formatting a device is started (or failed to start).
47  virtual void OnFormatStarted(
48      const std::string& device_path, bool success) = 0;
49
50  // Fired when formatting a device is completed (or terminated on error).
51  virtual void OnFormatCompleted(
52      const std::string& device_path, bool success) = 0;
53};
54
55}  // namespace file_manager
56
57#endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_OBSERVER_H_
58