| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ | 5 #ifndef CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| 6 #define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ | 6 #define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 13 #include "content/public/browser/browser_context.h" |
| 13 | 14 |
| 14 class FilePath; | 15 class FilePath; |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class BrowserContext; | 19 class BrowserContext; |
| 19 class StoragePartition; | 20 class StoragePartitionImpl; |
| 20 | 21 |
| 21 // A std::string to StoragePartition map for use with SupportsUserData APIs. | 22 // A std::string to StoragePartition map for use with SupportsUserData APIs. |
| 22 class StoragePartitionMap : public base::SupportsUserData::Data { | 23 class StoragePartitionImplMap : public base::SupportsUserData::Data { |
| 23 public: | 24 public: |
| 24 explicit StoragePartitionMap(BrowserContext* browser_context); | 25 explicit StoragePartitionImplMap(BrowserContext* browser_context); |
| 25 | 26 |
| 26 virtual ~StoragePartitionMap(); | 27 virtual ~StoragePartitionImplMap(); |
| 27 | 28 |
| 28 // This map retains ownership of the returned StoragePartition objects. | 29 // This map retains ownership of the returned StoragePartition objects. |
| 29 StoragePartition* Get(const std::string& partition_id); | 30 StoragePartitionImpl* Get(const std::string& partition_id); |
| 30 | 31 |
| 31 void ForEach(const base::Callback<void(StoragePartition*)>& callback); | 32 void ForEach(const BrowserContext::StoragePartitionCallback& callback); |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 // This must always be called *after* |partition| has been added to the | 35 // This must always be called *after* |partition| has been added to the |
| 35 // partitions_. | 36 // partitions_. |
| 36 // | 37 // |
| 37 // TODO(ajwong): Is there a way to make it so that Get()'s implementation | 38 // TODO(ajwong): Is there a way to make it so that Get()'s implementation |
| 38 // doesn't need to be aware of this ordering? Revisit when refactoring | 39 // doesn't need to be aware of this ordering? Revisit when refactoring |
| 39 // ResourceContext and AppCache to respect storage partitions. | 40 // ResourceContext and AppCache to respect storage partitions. |
| 40 void PostCreateInitialization(StoragePartition* partition, | 41 void PostCreateInitialization(StoragePartitionImpl* partition, |
| 41 const FilePath& partition_path); | 42 const FilePath& partition_path); |
| 42 | 43 |
| 43 BrowserContext* browser_context_; // Not Owned. | 44 BrowserContext* browser_context_; // Not Owned. |
| 44 std::map<std::string, StoragePartition*> partitions_; | 45 std::map<std::string, StoragePartitionImpl*> partitions_; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace content | 48 } // namespace content |
| 48 | 49 |
| 49 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ | 50 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| OLD | NEW |