Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: apps/saved_files_service.cc

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review, Devlin review. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/apps/app_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/containers/scoped_ptr_hash_map.h" 12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/value_conversions.h" 13 #include "base/value_conversions.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "extensions/browser/extension_host.h" 17 #include "extensions/browser/extension_host.h"
18 #include "extensions/browser/extension_prefs.h" 18 #include "extensions/browser/extension_prefs.h"
19 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
20 #include "extensions/browser/extension_util.h"
21 #include "extensions/browser/notification_types.h" 20 #include "extensions/browser/notification_types.h"
22 #include "extensions/common/permissions/api_permission.h" 21 #include "extensions/common/permissions/api_permission.h"
23 #include "extensions/common/permissions/permission_set.h" 22 #include "extensions/common/permissions/permission_set.h"
24 #include "extensions/common/permissions/permissions_data.h" 23 #include "extensions/common/permissions/permissions_data.h"
25 24
26 namespace apps { 25 namespace apps {
27 26
28 using extensions::APIPermission; 27 using extensions::APIPermission;
29 using extensions::Extension; 28 using extensions::Extension;
30 using extensions::ExtensionHost; 29 using extensions::ExtensionHost;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 253 }
255 254
256 const SavedFileEntry* SavedFilesService::GetFileEntry( 255 const SavedFileEntry* SavedFilesService::GetFileEntry(
257 const std::string& extension_id, 256 const std::string& extension_id,
258 const std::string& id) { 257 const std::string& id) {
259 return GetOrInsert(extension_id)->GetFileEntry(id); 258 return GetOrInsert(extension_id)->GetFileEntry(id);
260 } 259 }
261 260
262 void SavedFilesService::ClearQueueIfNoRetainPermission( 261 void SavedFilesService::ClearQueueIfNoRetainPermission(
263 const Extension* extension) { 262 const Extension* extension) {
264 if (extensions::util::IsEphemeralApp(extension->id(), profile_) || 263 if (!extension->permissions_data()->active_permissions().HasAPIPermission(
265 !extension->permissions_data()->active_permissions().HasAPIPermission(
266 APIPermission::kFileSystemRetainEntries)) { 264 APIPermission::kFileSystemRetainEntries)) {
267 ClearQueue(extension); 265 ClearQueue(extension);
268 } 266 }
269 } 267 }
270 268
271 void SavedFilesService::ClearQueue(const extensions::Extension* extension) { 269 void SavedFilesService::ClearQueue(const extensions::Extension* extension) {
272 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id()); 270 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id());
273 Clear(extension->id()); 271 Clear(extension->id());
274 } 272 }
275 273
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 void SavedFilesService::SetLruSizeForTest(int size) { 440 void SavedFilesService::SetLruSizeForTest(int size) {
443 g_max_saved_file_entries = size; 441 g_max_saved_file_entries = size;
444 } 442 }
445 443
446 // static 444 // static
447 void SavedFilesService::ClearLruSizeForTest() { 445 void SavedFilesService::ClearLruSizeForTest() {
448 g_max_saved_file_entries = kMaxSavedFileEntries; 446 g_max_saved_file_entries = kMaxSavedFileEntries;
449 } 447 }
450 448
451 } // namespace apps 449 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/apps/app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698