| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" | 13 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" |
| 14 #include "chrome/common/extensions/api/file_browser_private.h" | 14 #include "chrome/common/extensions/api/file_manager_private.h" |
| 15 #include "chromeos/dbus/power_manager_client.h" | 15 #include "chromeos/dbus/power_manager_client.h" |
| 16 | 16 |
| 17 namespace file_manager { | 17 namespace file_manager { |
| 18 | 18 |
| 19 enum DeviceState { | 19 enum DeviceState { |
| 20 // Device is not being scanned and is not hard unplugged. | 20 // Device is not being scanned and is not hard unplugged. |
| 21 DEVICE_STATE_USUAL, | 21 DEVICE_STATE_USUAL, |
| 22 DEVICE_SCANNED, | 22 DEVICE_SCANNED, |
| 23 DEVICE_SCANNED_AND_REPORTED, | 23 DEVICE_SCANNED_AND_REPORTED, |
| 24 DEVICE_HARD_UNPLUGGED, | 24 DEVICE_HARD_UNPLUGGED, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // PowerManagerClient::Observer overrides. | 59 // PowerManagerClient::Observer overrides. |
| 60 virtual void SuspendImminent() OVERRIDE; | 60 virtual void SuspendImminent() OVERRIDE; |
| 61 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE; | 61 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE; |
| 62 | 62 |
| 63 bool is_resuming() const { return is_resuming_; } | 63 bool is_resuming() const { return is_resuming_; } |
| 64 bool is_starting_up() const { return is_starting_up_; } | 64 bool is_starting_up() const { return is_starting_up_; } |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 // Handles a device event containing |type| and |device_path|. | 67 // Handles a device event containing |type| and |device_path|. |
| 68 virtual void OnDeviceEvent( | 68 virtual void OnDeviceEvent( |
| 69 extensions::api::file_browser_private::DeviceEventType type, | 69 extensions::api::file_manager_private::DeviceEventType type, |
| 70 const std::string& device_path) = 0; | 70 const std::string& device_path) = 0; |
| 71 // Returns external storage is disabled or not. | 71 // Returns external storage is disabled or not. |
| 72 virtual bool IsExternalStorageDisabled() = 0; | 72 virtual bool IsExternalStorageDisabled() = 0; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 void StartupDelayed(); | 75 void StartupDelayed(); |
| 76 void OnDeviceAddedDelayed(const std::string& device_path); | 76 void OnDeviceAddedDelayed(const std::string& device_path); |
| 77 void SuspendDoneDelayed(); | 77 void SuspendDoneDelayed(); |
| 78 | 78 |
| 79 // Obtains device state of the device having |device_path|. | 79 // Obtains device state of the device having |device_path|. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 base::ThreadChecker thread_checker_; | 100 base::ThreadChecker thread_checker_; |
| 101 | 101 |
| 102 // Note: This should remain the last member so it'll be destroyed and | 102 // Note: This should remain the last member so it'll be destroyed and |
| 103 // invalidate the weak pointers before any other members are destroyed. | 103 // invalidate the weak pointers before any other members are destroyed. |
| 104 base::WeakPtrFactory<DeviceEventRouter> weak_factory_; | 104 base::WeakPtrFactory<DeviceEventRouter> weak_factory_; |
| 105 DISALLOW_COPY_AND_ASSIGN(DeviceEventRouter); | 105 DISALLOW_COPY_AND_ASSIGN(DeviceEventRouter); |
| 106 }; | 106 }; |
| 107 } // namespace file_manager | 107 } // namespace file_manager |
| 108 | 108 |
| 109 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H
_ | 109 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_DEVICE_EVENT_ROUTER_H
_ |
| OLD | NEW |