OLD | NEW |
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 "apps/saved_files_service.h" | 5 #include "apps/saved_files_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "apps/saved_files_service_factory.h" | 10 #include "apps/saved_files_service_factory.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 const SavedFileEntry* SavedFilesService::GetFileEntry( | 256 const SavedFileEntry* SavedFilesService::GetFileEntry( |
257 const std::string& extension_id, | 257 const std::string& extension_id, |
258 const std::string& id) { | 258 const std::string& id) { |
259 return GetOrInsert(extension_id)->GetFileEntry(id); | 259 return GetOrInsert(extension_id)->GetFileEntry(id); |
260 } | 260 } |
261 | 261 |
262 void SavedFilesService::ClearQueueIfNoRetainPermission( | 262 void SavedFilesService::ClearQueueIfNoRetainPermission( |
263 const Extension* extension) { | 263 const Extension* extension) { |
264 if (extensions::util::IsEphemeralApp(extension->id(), profile_) || | 264 if (!extension->permissions_data()->active_permissions().HasAPIPermission( |
265 !extension->permissions_data()->active_permissions().HasAPIPermission( | |
266 APIPermission::kFileSystemRetainEntries)) { | 265 APIPermission::kFileSystemRetainEntries)) { |
267 ClearQueue(extension); | 266 ClearQueue(extension); |
268 } | 267 } |
269 } | 268 } |
270 | 269 |
271 void SavedFilesService::ClearQueue(const extensions::Extension* extension) { | 270 void SavedFilesService::ClearQueue(const extensions::Extension* extension) { |
272 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id()); | 271 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id()); |
273 Clear(extension->id()); | 272 Clear(extension->id()); |
274 } | 273 } |
275 | 274 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void SavedFilesService::SetLruSizeForTest(int size) { | 441 void SavedFilesService::SetLruSizeForTest(int size) { |
443 g_max_saved_file_entries = size; | 442 g_max_saved_file_entries = size; |
444 } | 443 } |
445 | 444 |
446 // static | 445 // static |
447 void SavedFilesService::ClearLruSizeForTest() { | 446 void SavedFilesService::ClearLruSizeForTest() { |
448 g_max_saved_file_entries = kMaxSavedFileEntries; | 447 g_max_saved_file_entries = kMaxSavedFileEntries; |
449 } | 448 } |
450 | 449 |
451 } // namespace apps | 450 } // namespace apps |
OLD | NEW |