OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/error_console/error_console.h" | 5 #include "chrome/browser/extensions/error_console/error_console.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // if it does, because we just use the default mask instead. | 90 // if it does, because we just use the default mask instead. |
91 prefs_->ReadPrefAsInteger(extension_id, kStoreExtensionErrorsPref, &mask); | 91 prefs_->ReadPrefAsInteger(extension_id, kStoreExtensionErrorsPref, &mask); |
92 | 92 |
93 if (enabled) | 93 if (enabled) |
94 mask |= 1 << type; | 94 mask |= 1 << type; |
95 else | 95 else |
96 mask &= ~(1 << type); | 96 mask &= ~(1 << type); |
97 | 97 |
98 prefs_->UpdateExtensionPref(extension_id, | 98 prefs_->UpdateExtensionPref(extension_id, |
99 kStoreExtensionErrorsPref, | 99 kStoreExtensionErrorsPref, |
100 base::Value::CreateIntegerValue(mask)); | 100 new base::FundamentalValue(mask)); |
101 } | 101 } |
102 | 102 |
103 void ErrorConsole::SetReportingAllForExtension( | 103 void ErrorConsole::SetReportingAllForExtension( |
104 const std::string& extension_id, bool enabled) { | 104 const std::string& extension_id, bool enabled) { |
105 DCHECK(thread_checker_.CalledOnValidThread()); | 105 DCHECK(thread_checker_.CalledOnValidThread()); |
106 if (!enabled_ || !Extension::IdIsValid(extension_id)) | 106 if (!enabled_ || !Extension::IdIsValid(extension_id)) |
107 return; | 107 return; |
108 | 108 |
109 int mask = 0; | 109 int mask = 0; |
110 if (enabled) | 110 if (enabled) |
111 mask = (1 << ExtensionError::NUM_ERROR_TYPES) - 1; | 111 mask = (1 << ExtensionError::NUM_ERROR_TYPES) - 1; |
112 | 112 |
113 prefs_->UpdateExtensionPref(extension_id, | 113 prefs_->UpdateExtensionPref(extension_id, |
114 kStoreExtensionErrorsPref, | 114 kStoreExtensionErrorsPref, |
115 base::Value::CreateIntegerValue(mask)); | 115 new base::FundamentalValue(mask)); |
116 } | 116 } |
117 | 117 |
118 bool ErrorConsole::IsReportingEnabledForExtension( | 118 bool ErrorConsole::IsReportingEnabledForExtension( |
119 const std::string& extension_id) const { | 119 const std::string& extension_id) const { |
120 DCHECK(thread_checker_.CalledOnValidThread()); | 120 DCHECK(thread_checker_.CalledOnValidThread()); |
121 if (!enabled_ || !Extension::IdIsValid(extension_id)) | 121 if (!enabled_ || !Extension::IdIsValid(extension_id)) |
122 return false; | 122 return false; |
123 | 123 |
124 return GetMaskForExtension(extension_id) != 0; | 124 return GetMaskForExtension(extension_id) != 0; |
125 } | 125 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ExtensionRegistry::Get(profile_)->GetExtensionById( | 279 ExtensionRegistry::Get(profile_)->GetExtensionById( |
280 extension_id, ExtensionRegistry::EVERYTHING); | 280 extension_id, ExtensionRegistry::EVERYTHING); |
281 if (extension && extension->location() == Manifest::UNPACKED) | 281 if (extension && extension->location() == Manifest::UNPACKED) |
282 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; | 282 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; |
283 | 283 |
284 // Otherwise, use the default mask. | 284 // Otherwise, use the default mask. |
285 return default_mask_; | 285 return default_mask_; |
286 } | 286 } |
287 | 287 |
288 } // namespace extensions | 288 } // namespace extensions |
OLD | NEW |