diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 17:19:18 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 17:19:18 +0000 |
commit | bb28e069474790ba5d46e07bb54412649a04c536 (patch) | |
tree | 9fc53b4a324fa2a214c8bd0e77e0ff11afb96d71 /chrome/browser/extensions/extensions_service.cc | |
parent | 2d268b537e9f420f952c22a0faeb6c52d047f463 (diff) | |
download | chromium_src-bb28e069474790ba5d46e07bb54412649a04c536.zip chromium_src-bb28e069474790ba5d46e07bb54412649a04c536.tar.gz chromium_src-bb28e069474790ba5d46e07bb54412649a04c536.tar.bz2 |
Add a centralized error reporter to the
extensions sytem. This can be called from any
component on any thread. The hope is that this
will encourage more thorough error handling.
Review URL: http://codereview.chromium.org/27165
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service.cc')
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 4c1a40f..9fc0040 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -14,6 +14,7 @@ #include "base/values.h" #include "net/base/file_stream.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/user_script_master.h" #include "chrome/browser/plugin_service.h" #include "chrome/common/json_value_serializer.h" @@ -22,7 +23,6 @@ #if defined(OS_WIN) #include "base/registry.h" -#include "chrome/common/win_util.h" #endif // ExtensionsService @@ -170,31 +170,6 @@ void ExtensionsService::OnExtensionsLoadedFromDirectory( delete new_extensions; } -void ExtensionsService::OnExtensionLoadError(bool alert_on_error, - const std::string& error) { - // TODO(aa): Print the error message out somewhere better. I think we are - // going to need some sort of 'extension inspector'. - LOG(WARNING) << error; - if (alert_on_error) { -#if defined(OS_WIN) - win_util::MessageBox(NULL, UTF8ToWide(error), - L"Extension load error", MB_OK | MB_SETFOREGROUND); -#endif - } -} - -void ExtensionsService::OnExtensionInstallError(bool alert_on_error, - const std::string& error) { - // TODO(erikkay): Print the error message out somewhere better. - LOG(WARNING) << error; - if (alert_on_error) { -#if defined(OS_WIN) - win_util::MessageBox(NULL, UTF8ToWide(error), - L"Extension load error", MB_OK | MB_SETFOREGROUND); -#endif - } -} - void ExtensionsService::OnExtensionInstalled(FilePath path, bool update) { NotificationService::current()->Notify( NotificationType::EXTENSION_INSTALLED, @@ -339,14 +314,11 @@ Extension* ExtensionsServiceBackend::LoadExtension() { void ExtensionsServiceBackend::ReportExtensionLoadError( const std::string &error) { - // TODO(port): note that this isn't guaranteed to work properly on Linux. std::string path_str = WideToASCII(extension_path_.ToWStringHack()); std::string message = StringPrintf("Could not load extension from '%s'. %s", path_str.c_str(), error.c_str()); - frontend_->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod( - frontend_, &ExtensionsServiceFrontendInterface::OnExtensionLoadError, - alert_on_error_, message)); + ExtensionErrorReporter::GetInstance()->ReportError(message, alert_on_error_); } void ExtensionsServiceBackend::ReportExtensionsLoaded( @@ -702,9 +674,7 @@ void ExtensionsServiceBackend::ReportExtensionInstallError( std::string message = StringPrintf("Could not install extension from '%s'. %s", path_str.c_str(), error.c_str()); - frontend_->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod( - frontend_, &ExtensionsServiceFrontendInterface::OnExtensionInstallError, - alert_on_error_, message)); + ExtensionErrorReporter::GetInstance()->ReportError(message, alert_on_error_); } void ExtensionsServiceBackend::ReportExtensionInstalled( |