| 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/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const char* path) { | 79 const char* path) { |
| 80 MountLibraryImpl* mount = static_cast<MountLibraryImpl*>(object); | 80 MountLibraryImpl* mount = static_cast<MountLibraryImpl*>(object); |
| 81 std::string devicepath = path; | 81 std::string devicepath = path; |
| 82 mount->ParseDisks(status); | 82 mount->ParseDisks(status); |
| 83 mount->UpdateMountStatus(status, evt, devicepath); | 83 mount->UpdateMountStatus(status, evt, devicepath); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void MountLibraryImpl::Init() { | 86 void MountLibraryImpl::Init() { |
| 87 // Getting the monitor status so that the daemon starts up. | 87 // Getting the monitor status so that the daemon starts up. |
| 88 MountStatus* mount = RetrieveMountInformation(); | 88 MountStatus* mount = RetrieveMountInformation(); |
| 89 ParseDisks(*mount); |
| 89 FreeMountStatus(mount); | 90 FreeMountStatus(mount); |
| 90 | 91 |
| 91 mount_status_connection_ = MonitorMountStatus( | 92 mount_status_connection_ = MonitorMountStatus( |
| 92 &MountStatusChangedHandler, this); | 93 &MountStatusChangedHandler, this); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void MountLibraryImpl::UpdateMountStatus(const MountStatus& status, | 96 void MountLibraryImpl::UpdateMountStatus(const MountStatus& status, |
| 96 MountEventType evt, | 97 MountEventType evt, |
| 97 const std::string& path) { | 98 const std::string& path) { |
| 98 // Make sure we run on UI thread. | 99 // Make sure we run on UI thread. |
| 99 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 100 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 100 | 101 |
| 101 FOR_EACH_OBSERVER(Observer, observers_, MountChanged(this, evt, path)); | 102 FOR_EACH_OBSERVER(Observer, observers_, MountChanged(this, evt, path)); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace chromeos | 105 } // namespace chromeos |
| OLD | NEW |