Chromium Code Reviews| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 DCHECK(thread_checker_.CalledOnValidThread()); | 162 DCHECK(thread_checker_.CalledOnValidThread()); |
| 163 observers_.AddObserver(observer); | 163 observers_.AddObserver(observer); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void ErrorConsole::RemoveObserver(Observer* observer) { | 166 void ErrorConsole::RemoveObserver(Observer* observer) { |
| 167 DCHECK(thread_checker_.CalledOnValidThread()); | 167 DCHECK(thread_checker_.CalledOnValidThread()); |
| 168 observers_.RemoveObserver(observer); | 168 observers_.RemoveObserver(observer); |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool ErrorConsole::IsEnabledForChromeExtensionsPage() const { | 171 bool ErrorConsole::IsEnabledForChromeExtensionsPage() const { |
| 172 FeatureSwitch* error_console = FeatureSwitch::error_console(); | |
|
Devlin
2015/05/07 23:04:14
I think this boolean result is right, but it's har
Dan Beam
2015/05/07 23:08:44
+10
| |
| 172 return profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && | 173 return profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && |
| 173 (FeatureSwitch::error_console()->IsEnabled() || | 174 (error_console->IsEnabled() || |
| 174 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV); | 175 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) && |
| 176 error_console->GetOverrideValue() != FeatureSwitch::OVERRIDE_DISABLED; | |
| 175 } | 177 } |
| 176 | 178 |
| 177 bool ErrorConsole::IsEnabledForAppsDeveloperTools() const { | 179 bool ErrorConsole::IsEnabledForAppsDeveloperTools() const { |
| 178 return ExtensionRegistry::Get(profile_)->enabled_extensions() | 180 return ExtensionRegistry::Get(profile_)->enabled_extensions() |
| 179 .Contains(kAppsDeveloperToolsExtensionId); | 181 .Contains(kAppsDeveloperToolsExtensionId); |
| 180 } | 182 } |
| 181 | 183 |
| 182 void ErrorConsole::CheckEnabled() { | 184 void ErrorConsole::CheckEnabled() { |
| 183 bool should_be_enabled = IsEnabledForChromeExtensionsPage() || | 185 bool should_be_enabled = IsEnabledForChromeExtensionsPage() || |
| 184 IsEnabledForAppsDeveloperTools(); | 186 IsEnabledForAppsDeveloperTools(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 ExtensionRegistry::Get(profile_)->GetExtensionById( | 289 ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 288 extension_id, ExtensionRegistry::EVERYTHING); | 290 extension_id, ExtensionRegistry::EVERYTHING); |
| 289 if (extension && extension->location() == Manifest::UNPACKED) | 291 if (extension && extension->location() == Manifest::UNPACKED) |
| 290 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; | 292 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; |
| 291 | 293 |
| 292 // Otherwise, use the default mask. | 294 // Otherwise, use the default mask. |
| 293 return default_mask_; | 295 return default_mask_; |
| 294 } | 296 } |
| 295 | 297 |
| 296 } // namespace extensions | 298 } // namespace extensions |
| OLD | NEW |