Index: content/browser/storage_partition_map.h |
diff --git a/content/browser/storage_partition_map.h b/content/browser/storage_partition_map.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fe76ffc8e5592fc575423b900de8955378f3273f |
--- /dev/null |
+++ b/content/browser/storage_partition_map.h |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
+#define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
+ |
+#include <map> |
+#include <string> |
+ |
+#include "base/callback_forward.h" |
+#include "base/supports_user_data.h" |
+ |
+namespace content { |
+class BrowserContext; |
+} |
+ |
+class FilePath; |
+class StoragePartition; |
+ |
+// A std::string to StoragePartition map for use with SupportsUserData APIs. |
+class StoragePartitionMap : public base::SupportsUserData::Data { |
jam
2012/07/11 23:36:31
ditto
awong
2012/07/12 20:28:40
Done.
|
+ public: |
+ explicit StoragePartitionMap(content::BrowserContext* browser_context); |
+ |
+ virtual ~StoragePartitionMap(); |
+ |
+ // This map retains ownership of the returned StoragePartition objects. |
+ StoragePartition* Get(const std::string& partition_id); |
+ |
+ void ForEach(const base::Callback<void(StoragePartition*)>& callback); |
+ |
+ private: |
+ // TODO(ajwong): This must always be called *after* it's been added to the |
+ // partition map. This feels dangerous. Should this not be in this class? |
jam
2012/07/11 23:36:31
i'm not sure i understand this comment. I would fi
awong
2012/07/12 20:28:40
It's not dangerous for users of the class, but for
|
+ void PostCreateInitialization(StoragePartition* partition, |
+ const FilePath& partition_path); |
+ |
+ content::BrowserContext* browser_context_; // Not Owned. |
+ std::map<std::string, StoragePartition*> partitions_; |
+}; |
+ |
+#endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |