OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/extension_pref_value_map.h" | 5 #include "extensions/browser/extension_pref_value_map.h" |
6 | 6 |
7 #include "base/prefs/pref_value_map.h" | 7 #include "base/prefs/pref_value_map.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 ExtensionPrefValueMap::ExtensionPrefValueMap() : destroyed_(false) { | 33 ExtensionPrefValueMap::ExtensionPrefValueMap() : destroyed_(false) { |
34 } | 34 } |
35 | 35 |
36 ExtensionPrefValueMap::~ExtensionPrefValueMap() { | 36 ExtensionPrefValueMap::~ExtensionPrefValueMap() { |
37 if (!destroyed_) { | 37 if (!destroyed_) { |
38 NotifyOfDestruction(); | 38 NotifyOfDestruction(); |
39 destroyed_ = true; | 39 destroyed_ = true; |
40 } | 40 } |
41 STLDeleteValues(&entries_); | 41 STLDeleteValues(&entries_); |
42 entries_.clear(); | |
43 } | 42 } |
44 | 43 |
45 void ExtensionPrefValueMap::Shutdown() { | 44 void ExtensionPrefValueMap::Shutdown() { |
46 NotifyOfDestruction(); | 45 NotifyOfDestruction(); |
47 destroyed_ = true; | 46 destroyed_ = true; |
48 } | 47 } |
49 | 48 |
50 void ExtensionPrefValueMap::SetExtensionPref(const std::string& ext_id, | 49 void ExtensionPrefValueMap::SetExtensionPref(const std::string& ext_id, |
51 const std::string& key, | 50 const std::string& key, |
52 ExtensionPrefsScope scope, | 51 ExtensionPrefsScope scope, |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 393 |
395 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { | 394 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { |
396 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, | 395 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, |
397 OnPrefValueChanged(key)); | 396 OnPrefValueChanged(key)); |
398 } | 397 } |
399 | 398 |
400 void ExtensionPrefValueMap::NotifyOfDestruction() { | 399 void ExtensionPrefValueMap::NotifyOfDestruction() { |
401 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, | 400 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, |
402 OnExtensionPrefValueMapDestruction()); | 401 OnExtensionPrefValueMapDestruction()); |
403 } | 402 } |
OLD | NEW |