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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_store.h

Issue 2436023002: Remove stl_util's deletion function use from chrome/browser/extensions/api/content_settings. (Closed)
Patch Set: reverse sort Created 4 years 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
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 CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
11 #include <vector>
10 12
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h" 15 #include "base/observer_list.h"
14 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
15 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
16 #include "base/time/time.h" 18 #include "base/time/time.h"
17 #include "components/content_settings/core/browser/content_settings_provider.h" 19 #include "components/content_settings/core/browser/content_settings_provider.h"
18 #include "components/content_settings/core/common/content_settings.h" 20 #include "components/content_settings/core/common/content_settings.h"
19 #include "components/content_settings/core/common/content_settings_pattern.h" 21 #include "components/content_settings/core/common/content_settings_pattern.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void AddObserver(Observer* observer); 107 void AddObserver(Observer* observer);
106 108
107 // Remove |observer|. This method should only be called on the UI thread. 109 // Remove |observer|. This method should only be called on the UI thread.
108 void RemoveObserver(Observer* observer); 110 void RemoveObserver(Observer* observer);
109 111
110 private: 112 private:
111 friend class base::RefCountedThreadSafe<ContentSettingsStore>; 113 friend class base::RefCountedThreadSafe<ContentSettingsStore>;
112 114
113 struct ExtensionEntry; 115 struct ExtensionEntry;
114 116
115 typedef std::multimap<base::Time, ExtensionEntry*> ExtensionEntryMap; 117 using ExtensionEntries = std::vector<std::unique_ptr<ExtensionEntry>>;
116 118
117 virtual ~ContentSettingsStore(); 119 virtual ~ContentSettingsStore();
118 120
119 content_settings::OriginIdentifierValueMap* GetValueMap( 121 content_settings::OriginIdentifierValueMap* GetValueMap(
120 const std::string& ext_id, 122 const std::string& ext_id,
121 ExtensionPrefsScope scope); 123 ExtensionPrefsScope scope);
122 124
123 const content_settings::OriginIdentifierValueMap* GetValueMap( 125 const content_settings::OriginIdentifierValueMap* GetValueMap(
124 const std::string& ext_id, 126 const std::string& ext_id,
125 ExtensionPrefsScope scope) const; 127 ExtensionPrefsScope scope) const;
126 128
127 void NotifyOfContentSettingChanged(const std::string& extension_id, 129 void NotifyOfContentSettingChanged(const std::string& extension_id,
128 bool incognito); 130 bool incognito);
129 131
130 bool OnCorrectThread(); 132 bool OnCorrectThread();
131 133
132 ExtensionEntryMap::iterator FindEntry(const std::string& ext_id); 134 ExtensionEntries::iterator FindEntry(const std::string& ext_id);
133 ExtensionEntryMap::const_iterator FindEntry(const std::string& ext_id) const; 135 ExtensionEntries::const_iterator FindEntry(const std::string& ext_id) const;
134 136
135 ExtensionEntryMap entries_; 137 // The entries. Maintained in reverse-chronological order (newest items first)
Devlin 2016/12/14 15:54:01 I wonder if the part about reverse-chronological o
Avi (use Gerrit) 2016/12/14 19:29:06 Done.
138 // to facilitate search.
139 ExtensionEntries entries_;
136 140
137 base::ObserverList<Observer, false> observers_; 141 base::ObserverList<Observer, false> observers_;
138 142
139 mutable base::Lock lock_; 143 mutable base::Lock lock_;
140 144
141 DISALLOW_COPY_AND_ASSIGN(ContentSettingsStore); 145 DISALLOW_COPY_AND_ASSIGN(ContentSettingsStore);
142 }; 146 };
143 147
144 } // namespace extensions 148 } // namespace extensions
145 149
146 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE _H_ 150 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_STORE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698