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

Side by Side Diff: content/browser/storage_partition_impl_map.h

Issue 11234032: Webview tag creation should be using storage partitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added IndexedDB test. Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/browser/storage_partition_impl.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 15
15 class FilePath; 16 class FilePath;
16 17
17 namespace content { 18 namespace content {
18 19
19 class BrowserContext; 20 class BrowserContext;
20 class StoragePartitionImpl;
21 21
22 // A std::string to StoragePartition map for use with SupportsUserData APIs. 22 // A std::string to StoragePartition map for use with SupportsUserData APIs.
23 class StoragePartitionImplMap : public base::SupportsUserData::Data { 23 class StoragePartitionImplMap : public base::SupportsUserData::Data {
24 public: 24 public:
25 explicit StoragePartitionImplMap(BrowserContext* browser_context); 25 explicit StoragePartitionImplMap(BrowserContext* browser_context);
26 26
27 virtual ~StoragePartitionImplMap(); 27 virtual ~StoragePartitionImplMap();
28 28
29 // This map retains ownership of the returned StoragePartition objects. 29 // This map retains ownership of the returned StoragePartition objects.
30 StoragePartitionImpl* Get(const std::string& partition_id); 30 StoragePartitionImpl* Get(const std::string& partition_domain,
31 const std::string& partition_name,
32 const bool& in_memory);
awong 2012/11/02 21:56:13 don't pass primitives by const&!!!!!!!
nasko 2012/11/03 00:36:24 Done.
31 33
32 void ForEach(const BrowserContext::StoragePartitionCallback& callback); 34 void ForEach(const BrowserContext::StoragePartitionCallback& callback);
33 35
34 private: 36 private:
35 // This must always be called *after* |partition| has been added to the 37 // This must always be called *after* |partition| has been added to the
36 // partitions_. 38 // partitions_.
37 // 39 //
38 // TODO(ajwong): Is there a way to make it so that Get()'s implementation 40 // TODO(ajwong): Is there a way to make it so that Get()'s implementation
39 // doesn't need to be aware of this ordering? Revisit when refactoring 41 // doesn't need to be aware of this ordering? Revisit when refactoring
40 // ResourceContext and AppCache to respect storage partitions. 42 // ResourceContext and AppCache to respect storage partitions.
41 void PostCreateInitialization(StoragePartitionImpl* partition); 43 void PostCreateInitialization(StoragePartitionImpl* partition);
42 44
43 BrowserContext* browser_context_; // Not Owned. 45 BrowserContext* browser_context_; // Not Owned.
44 std::map<std::string, StoragePartitionImpl*> partitions_; 46
47 // Boolean indicating whether we have initialized the ResourceContext for
48 // the |browser_context_| this map is associated with.
49 bool resource_context_initialized_;
50
51 typedef std::map<StoragePartitionImpl::StoragePartitionDescriptor,
awong 2012/11/02 21:56:13 typedefs should go at the start of their private:/
nasko 2012/11/03 00:36:24 Done.
52 StoragePartitionImpl*,
53 StoragePartitionImpl::StoragePartitionDescriptorLess>
54 PartitionsMap;
55 PartitionsMap partitions_;
45 }; 56 };
46 57
47 } // namespace content 58 } // namespace content
48 59
49 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ 60 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698