| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // if it does, because we just use the default mask instead. | 96 // if it does, because we just use the default mask instead. |
| 97 prefs_->ReadPrefAsInteger(extension_id, kStoreExtensionErrorsPref, &mask); | 97 prefs_->ReadPrefAsInteger(extension_id, kStoreExtensionErrorsPref, &mask); |
| 98 | 98 |
| 99 if (enabled) | 99 if (enabled) |
| 100 mask |= 1 << type; | 100 mask |= 1 << type; |
| 101 else | 101 else |
| 102 mask &= ~(1 << type); | 102 mask &= ~(1 << type); |
| 103 | 103 |
| 104 prefs_->UpdateExtensionPref(extension_id, | 104 prefs_->UpdateExtensionPref(extension_id, |
| 105 kStoreExtensionErrorsPref, | 105 kStoreExtensionErrorsPref, |
| 106 new base::FundamentalValue(mask)); | 106 new base::Value(mask)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ErrorConsole::SetReportingAllForExtension( | 109 void ErrorConsole::SetReportingAllForExtension( |
| 110 const std::string& extension_id, bool enabled) { | 110 const std::string& extension_id, bool enabled) { |
| 111 DCHECK(thread_checker_.CalledOnValidThread()); | 111 DCHECK(thread_checker_.CalledOnValidThread()); |
| 112 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) | 112 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 int mask = enabled ? (1 << ExtensionError::NUM_ERROR_TYPES) - 1 : 0; | 115 int mask = enabled ? (1 << ExtensionError::NUM_ERROR_TYPES) - 1 : 0; |
| 116 | 116 |
| 117 prefs_->UpdateExtensionPref(extension_id, | 117 prefs_->UpdateExtensionPref(extension_id, |
| 118 kStoreExtensionErrorsPref, | 118 kStoreExtensionErrorsPref, |
| 119 new base::FundamentalValue(mask)); | 119 new base::Value(mask)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool ErrorConsole::IsReportingEnabledForExtension( | 122 bool ErrorConsole::IsReportingEnabledForExtension( |
| 123 const std::string& extension_id) const { | 123 const std::string& extension_id) const { |
| 124 DCHECK(thread_checker_.CalledOnValidThread()); | 124 DCHECK(thread_checker_.CalledOnValidThread()); |
| 125 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) | 125 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) |
| 126 return false; | 126 return false; |
| 127 | 127 |
| 128 return GetMaskForExtension(extension_id) != 0; | 128 return GetMaskForExtension(extension_id) != 0; |
| 129 } | 129 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 ExtensionRegistry::Get(profile_)->GetExtensionById( | 294 ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 295 extension_id, ExtensionRegistry::EVERYTHING); | 295 extension_id, ExtensionRegistry::EVERYTHING); |
| 296 if (extension && extension->location() == Manifest::UNPACKED) | 296 if (extension && extension->location() == Manifest::UNPACKED) |
| 297 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; | 297 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; |
| 298 | 298 |
| 299 // Otherwise, use the default mask. | 299 // Otherwise, use the default mask. |
| 300 return default_mask_; | 300 return default_mask_; |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace extensions | 303 } // namespace extensions |
| OLD | NEW |