| 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" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/extensions/error_console/error_console_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 18 #include "chrome/common/extensions/features/feature_channel.h" | 19 #include "chrome/common/extensions/features/feature_channel.h" |
| 19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 20 #include "components/crx_file/id_util.h" | 21 #include "components/crx_file/id_util.h" |
| 21 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
| 22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 24 #include "extensions/browser/extension_prefs.h" | 25 #include "extensions/browser/extension_prefs.h" |
| 25 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 CheckEnabled(); | 73 CheckEnabled(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 ErrorConsole::~ErrorConsole() { | 76 ErrorConsole::~ErrorConsole() { |
| 76 FOR_EACH_OBSERVER(Observer, observers_, OnErrorConsoleDestroyed()); | 77 FOR_EACH_OBSERVER(Observer, observers_, OnErrorConsoleDestroyed()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 // static | 80 // static |
| 80 ErrorConsole* ErrorConsole::Get(content::BrowserContext* browser_context) { | 81 ErrorConsole* ErrorConsole::Get(content::BrowserContext* browser_context) { |
| 81 return ExtensionSystem::Get(browser_context)->error_console(); | 82 return ErrorConsoleFactory::GetForBrowserContext(browser_context); |
| 82 } | 83 } |
| 83 | 84 |
| 84 void ErrorConsole::SetReportingForExtension(const std::string& extension_id, | 85 void ErrorConsole::SetReportingForExtension(const std::string& extension_id, |
| 85 ExtensionError::Type type, | 86 ExtensionError::Type type, |
| 86 bool enabled) { | 87 bool enabled) { |
| 87 DCHECK(thread_checker_.CalledOnValidThread()); | 88 DCHECK(thread_checker_.CalledOnValidThread()); |
| 88 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) | 89 if (!enabled_ || !crx_file::id_util::IdIsValid(extension_id)) |
| 89 return; | 90 return; |
| 90 | 91 |
| 91 int mask = default_mask_; | 92 int mask = default_mask_; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 ExtensionRegistry::Get(profile_)->GetExtensionById( | 288 ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 288 extension_id, ExtensionRegistry::EVERYTHING); | 289 extension_id, ExtensionRegistry::EVERYTHING); |
| 289 if (extension && extension->location() == Manifest::UNPACKED) | 290 if (extension && extension->location() == Manifest::UNPACKED) |
| 290 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; | 291 return (1 << ExtensionError::NUM_ERROR_TYPES) - 1; |
| 291 | 292 |
| 292 // Otherwise, use the default mask. | 293 // Otherwise, use the default mask. |
| 293 return default_mask_; | 294 return default_mask_; |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace extensions | 297 } // namespace extensions |
| OLD | NEW |