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

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager.cc

Issue 339323002: Implement snapshotting for non-Drive non-local file systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/file_manager/volume_manager.h" 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 16 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
17 #include "chrome/browser/chromeos/drive/file_system_interface.h" 17 #include "chrome/browser/chromeos/drive/file_system_interface.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 18 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" 19 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h"
20 #include "chrome/browser/chromeos/file_manager/path_util.h" 20 #include "chrome/browser/chromeos/file_manager/path_util.h"
21 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h"
21 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" 22 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h"
22 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" 23 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h"
23 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 24 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
24 #include "chrome/browser/chromeos/profiles/profile_helper.h" 25 #include "chrome/browser/chromeos/profiles/profile_helper.h"
25 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" 26 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h"
26 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" 27 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h"
27 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
30 #include "chromeos/chromeos_switches.h" 31 #include "chromeos/chromeos_switches.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 drive::DriveIntegrationService* drive_integration_service, 250 drive::DriveIntegrationService* drive_integration_service,
250 chromeos::PowerManagerClient* power_manager_client, 251 chromeos::PowerManagerClient* power_manager_client,
251 chromeos::disks::DiskMountManager* disk_mount_manager, 252 chromeos::disks::DiskMountManager* disk_mount_manager,
252 chromeos::file_system_provider::Service* file_system_provider_service) 253 chromeos::file_system_provider::Service* file_system_provider_service)
253 : profile_(profile), 254 : profile_(profile),
254 drive_integration_service_(drive_integration_service), 255 drive_integration_service_(drive_integration_service),
255 disk_mount_manager_(disk_mount_manager), 256 disk_mount_manager_(disk_mount_manager),
256 mounted_disk_monitor_( 257 mounted_disk_monitor_(
257 new MountedDiskMonitor(power_manager_client, disk_mount_manager)), 258 new MountedDiskMonitor(power_manager_client, disk_mount_manager)),
258 file_system_provider_service_(file_system_provider_service), 259 file_system_provider_service_(file_system_provider_service),
260 snapshot_manager_(new SnapshotManager(profile_)),
259 weak_ptr_factory_(this) { 261 weak_ptr_factory_(this) {
260 DCHECK(disk_mount_manager); 262 DCHECK(disk_mount_manager);
261 } 263 }
262 264
263 VolumeManager::~VolumeManager() { 265 VolumeManager::~VolumeManager() {
264 } 266 }
265 267
266 VolumeManager* VolumeManager::Get(content::BrowserContext* context) { 268 VolumeManager* VolumeManager::Get(content::BrowserContext* context) {
267 return VolumeManagerFactory::Get(context); 269 return VolumeManagerFactory::Get(context);
268 } 270 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (!disable_mtp && storage_monitor::StorageMonitor::GetInstance()) { 398 if (!disable_mtp && storage_monitor::StorageMonitor::GetInstance()) {
397 storage_monitor::StorageMonitor::GetInstance()->EnsureInitialized( 399 storage_monitor::StorageMonitor::GetInstance()->EnsureInitialized(
398 base::Bind(&VolumeManager::OnStorageMonitorInitialized, 400 base::Bind(&VolumeManager::OnStorageMonitorInitialized,
399 weak_ptr_factory_.GetWeakPtr())); 401 weak_ptr_factory_.GetWeakPtr()));
400 } 402 }
401 } 403 }
402 404
403 void VolumeManager::Shutdown() { 405 void VolumeManager::Shutdown() {
404 weak_ptr_factory_.InvalidateWeakPtrs(); 406 weak_ptr_factory_.InvalidateWeakPtrs();
405 407
408 snapshot_manager_.reset();
406 pref_change_registrar_.RemoveAll(); 409 pref_change_registrar_.RemoveAll();
407 disk_mount_manager_->RemoveObserver(this); 410 disk_mount_manager_->RemoveObserver(this);
408 if (storage_monitor::StorageMonitor::GetInstance()) 411 if (storage_monitor::StorageMonitor::GetInstance())
409 storage_monitor::StorageMonitor::GetInstance()->RemoveObserver(this); 412 storage_monitor::StorageMonitor::GetInstance()->RemoveObserver(this);
410 413
411 if (drive_integration_service_) 414 if (drive_integration_service_)
412 drive_integration_service_->RemoveObserver(this); 415 drive_integration_service_->RemoveObserver(this);
413 416
414 if (file_system_provider_service_) 417 if (file_system_provider_service_)
415 file_system_provider_service_->RemoveObserver(this); 418 file_system_provider_service_->RemoveObserver(this);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 return; 836 return;
834 if (error_code == chromeos::MOUNT_ERROR_NONE) 837 if (error_code == chromeos::MOUNT_ERROR_NONE)
835 mounted_volumes_.erase(volume_info.volume_id); 838 mounted_volumes_.erase(volume_info.volume_id);
836 839
837 FOR_EACH_OBSERVER(VolumeManagerObserver, 840 FOR_EACH_OBSERVER(VolumeManagerObserver,
838 observers_, 841 observers_,
839 OnVolumeUnmounted(error_code, volume_info)); 842 OnVolumeUnmounted(error_code, volume_info));
840 } 843 }
841 844
842 } // namespace file_manager 845 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698