| 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" | 9 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
| 10 #include "chrome/browser/chromeos/file_system_provider/observer.h" | 10 #include "chrome/browser/chromeos/file_system_provider/observer.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Store the file system descriptor. Use the mount point name as the file | 106 // Store the file system descriptor. Use the mount point name as the file |
| 107 // system provider file system id. | 107 // system provider file system id. |
| 108 // Examples: | 108 // Examples: |
| 109 // file_system_id = 41 | 109 // file_system_id = 41 |
| 110 // mount_point_name = file_system_id = b33f1337-41-5aa5 | 110 // mount_point_name = file_system_id = b33f1337-41-5aa5 |
| 111 // mount_point_path = /provided/b33f1337-41-5aa5 | 111 // mount_point_path = /provided/b33f1337-41-5aa5 |
| 112 ProvidedFileSystemInfo file_system_info( | 112 ProvidedFileSystemInfo file_system_info( |
| 113 extension_id, file_system_id, file_system_name, mount_point_path); | 113 extension_id, file_system_id, file_system_name, mount_point_path); |
| 114 | 114 |
| 115 // The event router may be NULL for unit tests. | 115 // The event router may be NULL for unit tests. |
| 116 extensions::EventRouter* event_router = | 116 extensions::EventRouter* router = extensions::EventRouter::Get(profile_); |
| 117 extensions::ExtensionSystem::Get(profile_)->event_router(); | |
| 118 | 117 |
| 119 ProvidedFileSystemInterface* file_system = | 118 ProvidedFileSystemInterface* file_system = |
| 120 file_system_factory_.Run(event_router, file_system_info); | 119 file_system_factory_.Run(router, file_system_info); |
| 121 DCHECK(file_system); | 120 DCHECK(file_system); |
| 122 file_system_map_[file_system_id] = file_system; | 121 file_system_map_[file_system_id] = file_system; |
| 123 | 122 |
| 124 FOR_EACH_OBSERVER( | 123 FOR_EACH_OBSERVER( |
| 125 Observer, | 124 Observer, |
| 126 observers_, | 125 observers_, |
| 127 OnProvidedFileSystemMount(file_system_info, base::File::FILE_OK)); | 126 OnProvidedFileSystemMount(file_system_info, base::File::FILE_OK)); |
| 128 | 127 |
| 129 next_id_++; | 128 next_id_++; |
| 130 return file_system_id; | 129 return file_system_id; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // invoked, and observers notified, so there is no need to call them now. | 227 // invoked, and observers notified, so there is no need to call them now. |
| 229 if (error != base::File::FILE_OK) { | 228 if (error != base::File::FILE_OK) { |
| 230 FOR_EACH_OBSERVER(Observer, | 229 FOR_EACH_OBSERVER(Observer, |
| 231 observers_, | 230 observers_, |
| 232 OnProvidedFileSystemUnmount(file_system_info, error)); | 231 OnProvidedFileSystemUnmount(file_system_info, error)); |
| 233 } | 232 } |
| 234 } | 233 } |
| 235 | 234 |
| 236 } // namespace file_system_provider | 235 } // namespace file_system_provider |
| 237 } // namespace chromeos | 236 } // namespace chromeos |
| OLD | NEW |