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

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: Added more test cases Created 8 years 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
« no previous file with comments | « chrome/browser/policy/policy_loader_mac.cc ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_loader_mac.cc ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698