| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/chromeos/cros/mount_library.h" | 5 #include "chrome/browser/chromeos/cros/mount_library.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 void RemoveObserver(Observer* observer) { | 34 void RemoveObserver(Observer* observer) { |
| 35 observers_.RemoveObserver(observer); | 35 observers_.RemoveObserver(observer); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool MountPath(const char* device_path) { | 38 bool MountPath(const char* device_path) { |
| 39 return MountDevicePath(device_path); | 39 return MountDevicePath(device_path); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool IsBootPath(const char* device_path) { |
| 43 return IsBootDevicePath(device_path); |
| 44 } |
| 45 |
| 42 const DiskVector& disks() const { return disks_; } | 46 const DiskVector& disks() const { return disks_; } |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 void ParseDisks(const MountStatus& status) { | 49 void ParseDisks(const MountStatus& status) { |
| 46 disks_.clear(); | 50 disks_.clear(); |
| 47 for (int i = 0; i < status.size; i++) { | 51 for (int i = 0; i < status.size; i++) { |
| 48 std::string path; | 52 std::string path; |
| 49 std::string mountpath; | 53 std::string mountpath; |
| 50 std::string systempath; | 54 std::string systempath; |
| 51 bool parent; | 55 bool parent; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 class MountLibraryStubImpl : public MountLibrary { | 121 class MountLibraryStubImpl : public MountLibrary { |
| 118 public: | 122 public: |
| 119 MountLibraryStubImpl() {} | 123 MountLibraryStubImpl() {} |
| 120 virtual ~MountLibraryStubImpl() {} | 124 virtual ~MountLibraryStubImpl() {} |
| 121 | 125 |
| 122 // MountLibrary overrides. | 126 // MountLibrary overrides. |
| 123 virtual void AddObserver(Observer* observer) {} | 127 virtual void AddObserver(Observer* observer) {} |
| 124 virtual void RemoveObserver(Observer* observer) {} | 128 virtual void RemoveObserver(Observer* observer) {} |
| 125 virtual const DiskVector& disks() const { return disks_; } | 129 virtual const DiskVector& disks() const { return disks_; } |
| 126 virtual bool MountPath(const char* device_path) { return false; } | 130 virtual bool MountPath(const char* device_path) { return false; } |
| 131 virtual bool IsBootPath(const char* device_path) { return true; } |
| 127 | 132 |
| 128 private: | 133 private: |
| 129 // The list of disks found. | 134 // The list of disks found. |
| 130 DiskVector disks_; | 135 DiskVector disks_; |
| 131 | 136 |
| 132 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl); | 137 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl); |
| 133 }; | 138 }; |
| 134 | 139 |
| 135 // static | 140 // static |
| 136 MountLibrary* MountLibrary::GetImpl(bool stub) { | 141 MountLibrary* MountLibrary::GetImpl(bool stub) { |
| 137 if (stub) | 142 if (stub) |
| 138 return new MountLibraryStubImpl(); | 143 return new MountLibraryStubImpl(); |
| 139 else | 144 else |
| 140 return new MountLibraryImpl(); | 145 return new MountLibraryImpl(); |
| 141 } | 146 } |
| 142 | 147 |
| 143 } // namespace chromeos | 148 } // namespace chromeos |
| 144 | 149 |
| 145 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 150 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 146 // won't be deleted until it's last InvokeLater is run. | 151 // won't be deleted until it's last InvokeLater is run. |
| 147 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl); | 152 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl); |
| 148 | 153 |
| OLD | NEW |