OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // RemovableDeviceNotificationsLinux implementation. | 5 // RemovableDeviceNotificationsLinux implementation. |
6 | 6 |
7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
8 | 8 |
9 #include <mntent.h> | 9 #include <mntent.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 void RemovableDeviceNotificationsLinux::InitOnFileThread() { | 325 void RemovableDeviceNotificationsLinux::InitOnFileThread() { |
326 DCHECK(!initialized_); | 326 DCHECK(!initialized_); |
327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
328 initialized_ = true; | 328 initialized_ = true; |
329 | 329 |
330 // The callback passed to Watch() has to be unretained. Otherwise | 330 // The callback passed to Watch() has to be unretained. Otherwise |
331 // RemovableDeviceNotificationsLinux will live longer than expected, and | 331 // RemovableDeviceNotificationsLinux will live longer than expected, and |
332 // FilePathWatcher will get in trouble at shutdown time. | 332 // FilePathWatcher will get in trouble at shutdown time. |
333 bool ret = file_watcher_.Watch( | 333 bool ret = file_watcher_.Watch( |
334 mtab_path_, | 334 mtab_path_, false, |
335 base::Bind(&RemovableDeviceNotificationsLinux::OnFilePathChanged, | 335 base::Bind(&RemovableDeviceNotificationsLinux::OnFilePathChanged, |
336 base::Unretained(this))); | 336 base::Unretained(this))); |
337 if (!ret) { | 337 if (!ret) { |
338 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed"; | 338 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed"; |
339 return; | 339 return; |
340 } | 340 } |
341 | 341 |
342 UpdateMtab(); | 342 UpdateMtab(); |
343 } | 343 } |
344 | 344 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 mount_priority_map_[mount_device][mount_point] = removable; | 471 mount_priority_map_[mount_device][mount_point] = removable; |
472 | 472 |
473 if (removable) { | 473 if (removable) { |
474 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( | 474 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( |
475 device_id, GetDisplayNameForDevice(partition_size_in_bytes, name), | 475 device_id, GetDisplayNameForDevice(partition_size_in_bytes, name), |
476 mount_point.value()); | 476 mount_point.value()); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 } // namespace chrome | 480 } // namespace chrome |
OLD | NEW |