Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / content / browser / appcache / appcache_working_set.h
blob5b9d00a1e1c733d14733d5f08d7a578a8a1b4259
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_WORKING_SET_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_WORKING_SET_H_
8 #include <map>
10 #include "base/containers/hash_tables.h"
11 #include "content/common/content_export.h"
12 #include "url/gurl.h"
14 namespace content {
16 class AppCache;
17 class AppCacheGroup;
18 class AppCacheResponseInfo;
20 // Represents the working set of appcache object instances
21 // currently in memory.
22 class CONTENT_EXPORT AppCacheWorkingSet {
23 public:
24 typedef std::map<GURL, AppCacheGroup*> GroupMap;
26 AppCacheWorkingSet();
27 ~AppCacheWorkingSet();
29 void Disable();
30 bool is_disabled() const { return is_disabled_; }
32 void AddCache(AppCache* cache);
33 void RemoveCache(AppCache* cache);
34 AppCache* GetCache(int64 id) {
35 CacheMap::iterator it = caches_.find(id);
36 return (it != caches_.end()) ? it->second : NULL;
39 void AddGroup(AppCacheGroup* group);
40 void RemoveGroup(AppCacheGroup* group);
41 AppCacheGroup* GetGroup(const GURL& manifest_url) {
42 GroupMap::iterator it = groups_.find(manifest_url);
43 return (it != groups_.end()) ? it->second : NULL;
46 const GroupMap* GetGroupsInOrigin(const GURL& origin_url) {
47 return GetMutableGroupsInOrigin(origin_url);
50 void AddResponseInfo(AppCacheResponseInfo* response_info);
51 void RemoveResponseInfo(AppCacheResponseInfo* response_info);
52 AppCacheResponseInfo* GetResponseInfo(int64 id) {
53 ResponseInfoMap::iterator it = response_infos_.find(id);
54 return (it != response_infos_.end()) ? it->second : NULL;
57 private:
58 typedef base::hash_map<int64, AppCache*> CacheMap;
59 typedef std::map<GURL, GroupMap> GroupsByOriginMap;
60 typedef base::hash_map<int64, AppCacheResponseInfo*> ResponseInfoMap;
62 GroupMap* GetMutableGroupsInOrigin(const GURL& origin_url) {
63 GroupsByOriginMap::iterator it = groups_by_origin_.find(origin_url);
64 return (it != groups_by_origin_.end()) ? &it->second : NULL;
67 CacheMap caches_;
68 GroupMap groups_;
69 GroupsByOriginMap groups_by_origin_; // origin -> (manifest -> group)
70 ResponseInfoMap response_infos_;
71 bool is_disabled_;
74 } // namespace content
76 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_WORKING_SET_H_