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 #ifndef APPS_SAVED_FILES_SERVICE_H_ | 5 #ifndef APPS_SAVED_FILES_SERVICE_H_ |
6 #define APPS_SAVED_FILES_SERVICE_H_ | 6 #define APPS_SAVED_FILES_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 FRIEND_TEST_ALL_PREFIXES(::SavedFilesServiceUnitTest, | 104 FRIEND_TEST_ALL_PREFIXES(::SavedFilesServiceUnitTest, |
105 SequenceNumberCompactionTest); | 105 SequenceNumberCompactionTest); |
106 friend class ::SavedFilesServiceUnitTest; | 106 friend class ::SavedFilesServiceUnitTest; |
107 | 107 |
108 // A container for the registered files for an app. | 108 // A container for the registered files for an app. |
109 class SavedFiles; | 109 class SavedFiles; |
110 | 110 |
111 // content::NotificationObserver. | 111 // content::NotificationObserver. |
112 virtual void Observe(int type, | 112 virtual void Observe(int type, |
113 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
114 const content::NotificationDetails& details) OVERRIDE; | 114 const content::NotificationDetails& details) override; |
115 | 115 |
116 // Returns the SavedFiles for |extension_id| or NULL if one does not exist. | 116 // Returns the SavedFiles for |extension_id| or NULL if one does not exist. |
117 SavedFiles* Get(const std::string& extension_id) const; | 117 SavedFiles* Get(const std::string& extension_id) const; |
118 | 118 |
119 // Returns the SavedFiles for |extension_id|, creating it if necessary. | 119 // Returns the SavedFiles for |extension_id|, creating it if necessary. |
120 SavedFiles* GetOrInsert(const std::string& extension_id); | 120 SavedFiles* GetOrInsert(const std::string& extension_id); |
121 | 121 |
122 // Clears the SavedFiles for |extension_id|. | 122 // Clears the SavedFiles for |extension_id|. |
123 void Clear(const std::string& extension_id); | 123 void Clear(const std::string& extension_id); |
124 | 124 |
125 static void SetMaxSequenceNumberForTest(int max_value); | 125 static void SetMaxSequenceNumberForTest(int max_value); |
126 static void ClearMaxSequenceNumberForTest(); | 126 static void ClearMaxSequenceNumberForTest(); |
127 static void SetLruSizeForTest(int size); | 127 static void SetLruSizeForTest(int size); |
128 static void ClearLruSizeForTest(); | 128 static void ClearLruSizeForTest(); |
129 | 129 |
130 std::map<std::string, SavedFiles*> extension_id_to_saved_files_; | 130 std::map<std::string, SavedFiles*> extension_id_to_saved_files_; |
131 STLValueDeleter<std::map<std::string, SavedFiles*> > | 131 STLValueDeleter<std::map<std::string, SavedFiles*> > |
132 extension_id_to_saved_files_deleter_; | 132 extension_id_to_saved_files_deleter_; |
133 content::NotificationRegistrar registrar_; | 133 content::NotificationRegistrar registrar_; |
134 Profile* profile_; | 134 Profile* profile_; |
135 | 135 |
136 DISALLOW_COPY_AND_ASSIGN(SavedFilesService); | 136 DISALLOW_COPY_AND_ASSIGN(SavedFilesService); |
137 }; | 137 }; |
138 | 138 |
139 } // namespace apps | 139 } // namespace apps |
140 | 140 |
141 #endif // APPS_SAVED_FILES_SERVICE_H_ | 141 #endif // APPS_SAVED_FILES_SERVICE_H_ |
OLD | NEW |