OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_system_provider/service.h" | 5 #include "chrome/browser/chromeos/file_system_provider/service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 result->extension_id = extension->id(); | 349 result->extension_id = extension->id(); |
350 result->name = extension->name(); | 350 result->name = extension->name(); |
351 const extensions::FileSystemProviderCapabilities* const capabilities = | 351 const extensions::FileSystemProviderCapabilities* const capabilities = |
352 extensions::FileSystemProviderCapabilities::Get(extension); | 352 extensions::FileSystemProviderCapabilities::Get(extension); |
353 DCHECK(capabilities); | 353 DCHECK(capabilities); |
354 result->capabilities = *capabilities; | 354 result->capabilities = *capabilities; |
355 | 355 |
356 return true; | 356 return true; |
357 } | 357 } |
358 | 358 |
359 void Service::OnExtensionUnloaded( | 359 void Service::OnExtensionUnloaded(content::BrowserContext* browser_context, |
360 content::BrowserContext* browser_context, | 360 const extensions::Extension* extension, |
361 const extensions::Extension* extension, | 361 extensions::UnloadedExtensionReason reason) { |
362 extensions::UnloadedExtensionInfo::Reason reason) { | |
363 // Unmount all of the provided file systems associated with this extension. | 362 // Unmount all of the provided file systems associated with this extension. |
364 auto it = file_system_map_.begin(); | 363 auto it = file_system_map_.begin(); |
365 while (it != file_system_map_.end()) { | 364 while (it != file_system_map_.end()) { |
366 const ProvidedFileSystemInfo& file_system_info = | 365 const ProvidedFileSystemInfo& file_system_info = |
367 it->second->GetFileSystemInfo(); | 366 it->second->GetFileSystemInfo(); |
368 // Advance the iterator beforehand, otherwise it will become invalidated | 367 // Advance the iterator beforehand, otherwise it will become invalidated |
369 // by the UnmountFileSystem() call. | 368 // by the UnmountFileSystem() call. |
370 ++it; | 369 ++it; |
371 if (file_system_info.extension_id() == extension->id()) { | 370 if (file_system_info.extension_id() == extension->id()) { |
372 const base::File::Error unmount_result = UnmountFileSystem( | 371 const base::File::Error unmount_result = UnmountFileSystem( |
373 file_system_info.extension_id(), file_system_info.file_system_id(), | 372 file_system_info.extension_id(), file_system_info.file_system_id(), |
374 reason == extensions::UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN | 373 reason == extensions::UnloadedExtensionReason::PROFILE_SHUTDOWN |
375 ? UNMOUNT_REASON_SHUTDOWN | 374 ? UNMOUNT_REASON_SHUTDOWN |
376 : UNMOUNT_REASON_USER); | 375 : UNMOUNT_REASON_USER); |
377 DCHECK_EQ(base::File::FILE_OK, unmount_result); | 376 DCHECK_EQ(base::File::FILE_OK, unmount_result); |
378 } | 377 } |
379 } | 378 } |
380 } | 379 } |
381 | 380 |
382 void Service::OnExtensionLoaded(content::BrowserContext* browser_context, | 381 void Service::OnExtensionLoaded(content::BrowserContext* browser_context, |
383 const extensions::Extension* extension) { | 382 const extensions::Extension* extension) { |
384 std::unique_ptr<RegistryInterface::RestoredFileSystems> | 383 std::unique_ptr<RegistryInterface::RestoredFileSystems> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 } | 453 } |
455 | 454 |
456 void Service::OnWatcherListChanged( | 455 void Service::OnWatcherListChanged( |
457 const ProvidedFileSystemInfo& file_system_info, | 456 const ProvidedFileSystemInfo& file_system_info, |
458 const Watchers& watchers) { | 457 const Watchers& watchers) { |
459 registry_->RememberFileSystem(file_system_info, watchers); | 458 registry_->RememberFileSystem(file_system_info, watchers); |
460 } | 459 } |
461 | 460 |
462 } // namespace file_system_provider | 461 } // namespace file_system_provider |
463 } // namespace chromeos | 462 } // namespace chromeos |
OLD | NEW |