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 <stdint.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 #include <map> | 10 #include <map> |
9 | 11 |
10 #include "apps/saved_files_service_factory.h" | 12 #include "apps/saved_files_service_factory.h" |
11 #include "base/basictypes.h" | |
12 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
13 #include "base/value_conversions.h" | 14 #include "base/value_conversions.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
17 #include "extensions/browser/extension_host.h" | 18 #include "extensions/browser/extension_host.h" |
18 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
19 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
20 #include "extensions/browser/extension_util.h" | 21 #include "extensions/browser/extension_util.h" |
21 #include "extensions/browser/notification_types.h" | 22 #include "extensions/browser/notification_types.h" |
(...skipping 18 matching lines...) Expand all Loading... |
40 // The path to a file entry that the app had permission to access. | 41 // The path to a file entry that the app had permission to access. |
41 const char kFileEntryPath[] = "path"; | 42 const char kFileEntryPath[] = "path"; |
42 | 43 |
43 // Whether or not the the entry refers to a directory. | 44 // Whether or not the the entry refers to a directory. |
44 const char kFileEntryIsDirectory[] = "is_directory"; | 45 const char kFileEntryIsDirectory[] = "is_directory"; |
45 | 46 |
46 // The sequence number in the LRU of the file entry. | 47 // The sequence number in the LRU of the file entry. |
47 const char kFileEntrySequenceNumber[] = "sequence_number"; | 48 const char kFileEntrySequenceNumber[] = "sequence_number"; |
48 | 49 |
49 const size_t kMaxSavedFileEntries = 500; | 50 const size_t kMaxSavedFileEntries = 500; |
50 const int kMaxSequenceNumber = kint32max; | 51 const int kMaxSequenceNumber = INT32_MAX; |
51 | 52 |
52 // These might be different to the constant values in tests. | 53 // These might be different to the constant values in tests. |
53 size_t g_max_saved_file_entries = kMaxSavedFileEntries; | 54 size_t g_max_saved_file_entries = kMaxSavedFileEntries; |
54 int g_max_sequence_number = kMaxSequenceNumber; | 55 int g_max_sequence_number = kMaxSequenceNumber; |
55 | 56 |
56 // Persists a SavedFileEntry in ExtensionPrefs. | 57 // Persists a SavedFileEntry in ExtensionPrefs. |
57 void AddSavedFileEntry(ExtensionPrefs* prefs, | 58 void AddSavedFileEntry(ExtensionPrefs* prefs, |
58 const std::string& extension_id, | 59 const std::string& extension_id, |
59 const SavedFileEntry& file_entry) { | 60 const SavedFileEntry& file_entry) { |
60 ExtensionPrefs::ScopedDictionaryUpdate update( | 61 ExtensionPrefs::ScopedDictionaryUpdate update( |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void SavedFilesService::SetLruSizeForTest(int size) { | 443 void SavedFilesService::SetLruSizeForTest(int size) { |
443 g_max_saved_file_entries = size; | 444 g_max_saved_file_entries = size; |
444 } | 445 } |
445 | 446 |
446 // static | 447 // static |
447 void SavedFilesService::ClearLruSizeForTest() { | 448 void SavedFilesService::ClearLruSizeForTest() { |
448 g_max_saved_file_entries = kMaxSavedFileEntries; | 449 g_max_saved_file_entries = kMaxSavedFileEntries; |
449 } | 450 } |
450 | 451 |
451 } // namespace apps | 452 } // namespace apps |
OLD | NEW |