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/runtime_data.h" | 5 #include "extensions/browser/runtime_data.h" |
6 | 6 |
7 #include "extensions/browser/extension_registry.h" | 7 #include "extensions/browser/extension_registry.h" |
8 #include "extensions/common/extension.h" | 8 #include "extensions/common/extension.h" |
9 #include "extensions/common/manifest_handlers/background_info.h" | 9 #include "extensions/common/manifest_handlers/background_info.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 bool RuntimeData::HasExtensionForTesting(const Extension* extension) const { | 48 bool RuntimeData::HasExtensionForTesting(const Extension* extension) const { |
49 return extension_flags_.find(extension->id()) != extension_flags_.end(); | 49 return extension_flags_.find(extension->id()) != extension_flags_.end(); |
50 } | 50 } |
51 | 51 |
52 void RuntimeData::ClearAll() { | 52 void RuntimeData::ClearAll() { |
53 extension_flags_.clear(); | 53 extension_flags_.clear(); |
54 } | 54 } |
55 | 55 |
56 void RuntimeData::OnExtensionUnloaded(const Extension* extension) { | 56 void RuntimeData::OnExtensionUnloaded( |
| 57 content::BrowserContext* browser_context, |
| 58 const Extension* extension) { |
57 extension_flags_.erase(extension->id()); | 59 extension_flags_.erase(extension->id()); |
58 } | 60 } |
59 | 61 |
60 bool RuntimeData::HasFlag(const Extension* extension, RuntimeFlag flag) const { | 62 bool RuntimeData::HasFlag(const Extension* extension, RuntimeFlag flag) const { |
61 ExtensionFlagsMap::const_iterator it = extension_flags_.find(extension->id()); | 63 ExtensionFlagsMap::const_iterator it = extension_flags_.find(extension->id()); |
62 if (it == extension_flags_.end()) | 64 if (it == extension_flags_.end()) |
63 return false; | 65 return false; |
64 return !!(it->second & flag); | 66 return !!(it->second & flag); |
65 } | 67 } |
66 | 68 |
67 void RuntimeData::SetFlag(const Extension* extension, | 69 void RuntimeData::SetFlag(const Extension* extension, |
68 RuntimeFlag flag, | 70 RuntimeFlag flag, |
69 bool value) { | 71 bool value) { |
70 if (value) | 72 if (value) |
71 extension_flags_[extension->id()] |= flag; | 73 extension_flags_[extension->id()] |= flag; |
72 else | 74 else |
73 extension_flags_[extension->id()] &= ~flag; | 75 extension_flags_[extension->id()] &= ~flag; |
74 } | 76 } |
75 | 77 |
76 } // namespace extensions | 78 } // namespace extensions |
OLD | NEW |