Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: chrome/browser/system_monitor/removable_device_notifications_linux.cc

Issue 11415066: FilePathWatcher::Watch() - Listen for sub directory changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 void RemovableDeviceNotificationsLinux::InitOnFileThread() { 356 void RemovableDeviceNotificationsLinux::InitOnFileThread() {
357 DCHECK(!initialized_); 357 DCHECK(!initialized_);
358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
359 initialized_ = true; 359 initialized_ = true;
360 360
361 // The callback passed to Watch() has to be unretained. Otherwise 361 // The callback passed to Watch() has to be unretained. Otherwise
362 // RemovableDeviceNotificationsLinux will live longer than expected, and 362 // RemovableDeviceNotificationsLinux will live longer than expected, and
363 // FilePathWatcher will get in trouble at shutdown time. 363 // FilePathWatcher will get in trouble at shutdown time.
364 bool ret = file_watcher_.Watch( 364 bool ret = file_watcher_.Watch(
365 mtab_path_, 365 mtab_path_, false,
366 base::Bind(&RemovableDeviceNotificationsLinux::OnFilePathChanged, 366 base::Bind(&RemovableDeviceNotificationsLinux::OnFilePathChanged,
367 base::Unretained(this))); 367 base::Unretained(this)));
368 if (!ret) { 368 if (!ret) {
369 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed"; 369 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed";
370 return; 370 return;
371 } 371 }
372 372
373 UpdateMtab(); 373 UpdateMtab();
374 } 374 }
375 375
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 mount_priority_map_[mount_device][mount_point] = removable; 502 mount_priority_map_[mount_device][mount_point] = removable;
503 503
504 if (removable) { 504 if (removable) {
505 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( 505 base::SystemMonitor::Get()->ProcessRemovableStorageAttached(
506 device_id, GetDisplayNameForDevice(partition_size_in_bytes, name), 506 device_id, GetDisplayNameForDevice(partition_size_in_bytes, name),
507 mount_point.value()); 507 mount_point.value());
508 } 508 }
509 } 509 }
510 510
511 } // namespace chrome 511 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698