| 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 "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Maximum number of file systems to be mounted in the same time, per profile. | 35 // Maximum number of file systems to be mounted in the same time, per profile. |
| 36 const size_t kMaxFileSystems = 16; | 36 const size_t kMaxFileSystems = 16; |
| 37 | 37 |
| 38 // Default factory for provided file systems. |profile| must not be NULL. | 38 // Default factory for provided file systems. |profile| must not be NULL. |
| 39 ProvidedFileSystemInterface* CreateProvidedFileSystem( | 39 ProvidedFileSystemInterface* CreateProvidedFileSystem( |
| 40 Profile* profile, | 40 Profile* profile, |
| 41 const ProvidedFileSystemInfo& file_system_info) { | 41 const ProvidedFileSystemInfo& file_system_info) { |
| 42 DCHECK(profile); | 42 DCHECK(profile); |
| 43 return new ThrottledFileSystem( | 43 return new ThrottledFileSystem( |
| 44 base::WrapUnique(new ProvidedFileSystem(profile, file_system_info))); | 44 base::MakeUnique<ProvidedFileSystem>(profile, file_system_info)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 ProvidingExtensionInfo::ProvidingExtensionInfo() { | 49 ProvidingExtensionInfo::ProvidingExtensionInfo() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 ProvidingExtensionInfo::~ProvidingExtensionInfo() { | 52 ProvidingExtensionInfo::~ProvidingExtensionInfo() { |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 DCHECK(event_router); | 277 DCHECK(event_router); |
| 278 | 278 |
| 279 if (!event_router->ExtensionHasEventListener( | 279 if (!event_router->ExtensionHasEventListener( |
| 280 extension_id, extensions::api::file_system_provider:: | 280 extension_id, extensions::api::file_system_provider:: |
| 281 OnMountRequested::kEventName)) { | 281 OnMountRequested::kEventName)) { |
| 282 return false; | 282 return false; |
| 283 } | 283 } |
| 284 | 284 |
| 285 event_router->DispatchEventToExtension( | 285 event_router->DispatchEventToExtension( |
| 286 extension_id, | 286 extension_id, |
| 287 base::WrapUnique(new extensions::Event( | 287 base::MakeUnique<extensions::Event>( |
| 288 extensions::events::FILE_SYSTEM_PROVIDER_ON_MOUNT_REQUESTED, | 288 extensions::events::FILE_SYSTEM_PROVIDER_ON_MOUNT_REQUESTED, |
| 289 extensions::api::file_system_provider::OnMountRequested::kEventName, | 289 extensions::api::file_system_provider::OnMountRequested::kEventName, |
| 290 std::unique_ptr<base::ListValue>(new base::ListValue())))); | 290 std::unique_ptr<base::ListValue>(new base::ListValue()))); |
| 291 | 291 |
| 292 return true; | 292 return true; |
| 293 } | 293 } |
| 294 | 294 |
| 295 std::vector<ProvidedFileSystemInfo> Service::GetProvidedFileSystemInfoList() { | 295 std::vector<ProvidedFileSystemInfo> Service::GetProvidedFileSystemInfoList() { |
| 296 DCHECK(thread_checker_.CalledOnValidThread()); | 296 DCHECK(thread_checker_.CalledOnValidThread()); |
| 297 | 297 |
| 298 std::vector<ProvidedFileSystemInfo> result; | 298 std::vector<ProvidedFileSystemInfo> result; |
| 299 for (ProvidedFileSystemMap::const_iterator it = file_system_map_.begin(); | 299 for (ProvidedFileSystemMap::const_iterator it = file_system_map_.begin(); |
| 300 it != file_system_map_.end(); | 300 it != file_system_map_.end(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 459 } |
| 460 | 460 |
| 461 void Service::OnWatcherListChanged( | 461 void Service::OnWatcherListChanged( |
| 462 const ProvidedFileSystemInfo& file_system_info, | 462 const ProvidedFileSystemInfo& file_system_info, |
| 463 const Watchers& watchers) { | 463 const Watchers& watchers) { |
| 464 registry_->RememberFileSystem(file_system_info, watchers); | 464 registry_->RememberFileSystem(file_system_info, watchers); |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace file_system_provider | 467 } // namespace file_system_provider |
| 468 } // namespace chromeos | 468 } // namespace chromeos |
| OLD | NEW |