| 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 <libudev.h> | 9 #include <libudev.h> |
| 10 #include <mntent.h> | 10 #include <mntent.h> |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 RemovableDeviceNotificationsLinux::MountPointInfo::MountPointInfo() { | 234 RemovableDeviceNotificationsLinux::MountPointInfo::MountPointInfo() { |
| 235 } | 235 } |
| 236 | 236 |
| 237 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( | 237 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| 238 const FilePath& path) | 238 const FilePath& path) |
| 239 : initialized_(false), | 239 : initialized_(false), |
| 240 mtab_path_(path), | 240 mtab_path_(path), |
| 241 get_device_info_func_(&GetDeviceInfo) { | 241 get_device_info_func_(&GetDeviceInfo) { |
| 242 DCHECK(!g_removable_device_notifications_linux); | 242 DCHECK(!g_removable_device_notifications_linux); |
| 243 g_removable_device_notifications_linux = this; | 243 g_removable_device_notifications_linux = this; |
| 244 |
| 245 if (SystemMonitor::Get()) |
| 246 SystemMonitor::Get()->set_storage_free_space_delegate(this); |
| 244 } | 247 } |
| 245 | 248 |
| 246 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( | 249 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| 247 const FilePath& path, | 250 const FilePath& path, |
| 248 GetDeviceInfoFunc get_device_info_func) | 251 GetDeviceInfoFunc get_device_info_func) |
| 249 : initialized_(false), | 252 : initialized_(false), |
| 250 mtab_path_(path), | 253 mtab_path_(path), |
| 251 get_device_info_func_(get_device_info_func) { | 254 get_device_info_func_(get_device_info_func) { |
| 252 DCHECK(!g_removable_device_notifications_linux); | 255 DCHECK(!g_removable_device_notifications_linux); |
| 253 g_removable_device_notifications_linux = this; | 256 g_removable_device_notifications_linux = this; |
| 257 if (SystemMonitor::Get()) |
| 258 SystemMonitor::Get()->set_storage_free_space_delegate(this); |
| 254 } | 259 } |
| 255 | 260 |
| 256 RemovableDeviceNotificationsLinux::~RemovableDeviceNotificationsLinux() { | 261 RemovableDeviceNotificationsLinux::~RemovableDeviceNotificationsLinux() { |
| 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 258 DCHECK_EQ(this, g_removable_device_notifications_linux); | 263 DCHECK_EQ(this, g_removable_device_notifications_linux); |
| 259 g_removable_device_notifications_linux = NULL; | 264 g_removable_device_notifications_linux = NULL; |
| 265 if (SystemMonitor::Get()) |
| 266 SystemMonitor::Get()->set_storage_free_space_delegate(NULL); |
| 260 } | 267 } |
| 261 | 268 |
| 262 // static | 269 // static |
| 263 RemovableDeviceNotificationsLinux* | 270 RemovableDeviceNotificationsLinux* |
| 264 RemovableDeviceNotificationsLinux::GetInstance() { | 271 RemovableDeviceNotificationsLinux::GetInstance() { |
| 265 DCHECK(g_removable_device_notifications_linux != NULL); | 272 DCHECK(g_removable_device_notifications_linux != NULL); |
| 266 return g_removable_device_notifications_linux; | 273 return g_removable_device_notifications_linux; |
| 267 } | 274 } |
| 268 | 275 |
| 269 void RemovableDeviceNotificationsLinux::Init() { | 276 void RemovableDeviceNotificationsLinux::Init() { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 506 |
| 500 mount_info_map_[mount_point] = mount_point_info; | 507 mount_info_map_[mount_point] = mount_point_info; |
| 501 mount_priority_map_[mount_device][mount_point] = removable; | 508 mount_priority_map_[mount_device][mount_point] = removable; |
| 502 | 509 |
| 503 if (removable) { | 510 if (removable) { |
| 504 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, | 511 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, |
| 505 mount_point.value()); | 512 mount_point.value()); |
| 506 } | 513 } |
| 507 } | 514 } |
| 508 | 515 |
| 516 bool RemovableDeviceNotificationsLinux::IsWatchingStorage( |
| 517 const FilePath& path) { |
| 518 NOTIMPLEMENTED(); |
| 519 return false; |
| 520 } |
| 521 |
| 522 void RemovableDeviceNotificationsLinux::StartWatchingStorage( |
| 523 const FilePath& path) { |
| 524 NOTIMPLEMENTED(); |
| 525 } |
| 526 |
| 527 void RemovableDeviceNotificationsLinux::StopWatchingStorage( |
| 528 const FilePath& path) { |
| 529 NOTIMPLEMENTED(); |
| 530 } |
| 531 |
| 509 } // namespace chrome | 532 } // namespace chrome |
| OLD | NEW |