OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/plugin_private_storage_helper.h" | 5 #include "content/browser/plugin_private_storage_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (result != base::File::FILE_OK) { | 135 if (result != base::File::FILE_OK) { |
136 DecrementTaskCount(); | 136 DecrementTaskCount(); |
137 return; | 137 return; |
138 } | 138 } |
139 | 139 |
140 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | 140 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( |
141 storage::kFileSystemTypePluginPrivate); | 141 storage::kFileSystemTypePluginPrivate); |
142 std::string root = storage::GetIsolatedFileSystemRootURIString( | 142 std::string root = storage::GetIsolatedFileSystemRootURIString( |
143 origin_, fsid_, ppapi::kPluginPrivateRootName); | 143 origin_, fsid_, ppapi::kPluginPrivateRootName); |
144 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | 144 std::unique_ptr<storage::FileSystemOperationContext> operation_context = |
145 base::WrapUnique( | 145 base::MakeUnique<storage::FileSystemOperationContext>( |
146 new storage::FileSystemOperationContext(filesystem_context_)); | 146 filesystem_context_); |
147 file_util->ReadDirectory( | 147 file_util->ReadDirectory( |
148 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), | 148 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), |
149 base::Bind(&PluginPrivateDataByOriginChecker::OnDirectoryRead, | 149 base::Bind(&PluginPrivateDataByOriginChecker::OnDirectoryRead, |
150 base::Unretained(this), root)); | 150 base::Unretained(this), root)); |
151 } | 151 } |
152 | 152 |
153 void PluginPrivateDataByOriginChecker::OnDirectoryRead( | 153 void PluginPrivateDataByOriginChecker::OnDirectoryRead( |
154 const std::string& root, | 154 const std::string& root, |
155 base::File::Error result, | 155 base::File::Error result, |
156 const storage::AsyncFileUtil::EntryList& file_list, | 156 const storage::AsyncFileUtil::EntryList& file_list, |
(...skipping 13 matching lines...) Expand all Loading... |
170 // No error, process the files returned. No need to do this if we have | 170 // No error, process the files returned. No need to do this if we have |
171 // already decided to delete all the data for this origin. | 171 // already decided to delete all the data for this origin. |
172 if (!delete_this_origin_data_) { | 172 if (!delete_this_origin_data_) { |
173 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | 173 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( |
174 storage::kFileSystemTypePluginPrivate); | 174 storage::kFileSystemTypePluginPrivate); |
175 for (const auto& file : file_list) { | 175 for (const auto& file : file_list) { |
176 DVLOG(3) << __func__ << " file: " << file.name; | 176 DVLOG(3) << __func__ << " file: " << file.name; |
177 DCHECK(!file.is_directory); // Nested directories not implemented. | 177 DCHECK(!file.is_directory); // Nested directories not implemented. |
178 | 178 |
179 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | 179 std::unique_ptr<storage::FileSystemOperationContext> operation_context = |
180 base::WrapUnique( | 180 base::MakeUnique<storage::FileSystemOperationContext>( |
181 new storage::FileSystemOperationContext(filesystem_context_)); | 181 filesystem_context_); |
182 storage::FileSystemURL file_url = filesystem_context_->CrackURL( | 182 storage::FileSystemURL file_url = filesystem_context_->CrackURL( |
183 GURL(root + StringTypeToString(file.name))); | 183 GURL(root + StringTypeToString(file.name))); |
184 IncrementTaskCount(); | 184 IncrementTaskCount(); |
185 file_util->GetFileInfo( | 185 file_util->GetFileInfo( |
186 std::move(operation_context), file_url, | 186 std::move(operation_context), file_url, |
187 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | | 187 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | |
188 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | 188 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, |
189 base::Bind(&PluginPrivateDataByOriginChecker::OnFileInfo, | 189 base::Bind(&PluginPrivateDataByOriginChecker::OnFileInfo, |
190 base::Unretained(this), StringTypeToString(file.name))); | 190 base::Unretained(this), StringTypeToString(file.name))); |
191 } | 191 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 origins.insert(storage_origin); | 406 origins.insert(storage_origin); |
407 } | 407 } |
408 | 408 |
409 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( | 409 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( |
410 std::move(filesystem_context), begin, end, callback); | 410 std::move(filesystem_context), begin, end, callback); |
411 helper->CheckOriginsOnFileTaskRunner(origins); | 411 helper->CheckOriginsOnFileTaskRunner(origins); |
412 // |helper| will delete itself when all origins have been checked. | 412 // |helper| will delete itself when all origins have been checked. |
413 } | 413 } |
414 | 414 |
415 } // namespace content | 415 } // namespace content |
OLD | NEW |