OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_error_reporter.h" | 5 #include "chrome/browser/extensions/extension_error_reporter.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/platform_util.h" | 12 #include "chrome/browser/simple_message_box.h" |
13 | 13 |
14 // No AddRef required when using ExtensionErrorReporter with RunnableMethod. | 14 // No AddRef required when using ExtensionErrorReporter with RunnableMethod. |
15 // This is okay since the ExtensionErrorReporter is a singleton that lives until | 15 // This is okay since the ExtensionErrorReporter is a singleton that lives until |
16 // the end of the process. | 16 // the end of the process. |
17 DISABLE_RUNNABLE_METHOD_REFCOUNT(ExtensionErrorReporter); | 17 DISABLE_RUNNABLE_METHOD_REFCOUNT(ExtensionErrorReporter); |
18 | 18 |
19 ExtensionErrorReporter* ExtensionErrorReporter::instance_ = NULL; | 19 ExtensionErrorReporter* ExtensionErrorReporter::instance_ = NULL; |
20 | 20 |
21 // static | 21 // static |
22 void ExtensionErrorReporter::Init(bool enable_noisy_errors) { | 22 void ExtensionErrorReporter::Init(bool enable_noisy_errors) { |
(...skipping 25 matching lines...) Expand all Loading... |
48 return; | 48 return; |
49 } | 49 } |
50 | 50 |
51 errors_.push_back(message); | 51 errors_.push_back(message); |
52 | 52 |
53 // TODO(aa): Print the error message out somewhere better. I think we are | 53 // TODO(aa): Print the error message out somewhere better. I think we are |
54 // going to need some sort of 'extension inspector'. | 54 // going to need some sort of 'extension inspector'. |
55 LOG(ERROR) << "Extension error: " << message; | 55 LOG(ERROR) << "Extension error: " << message; |
56 | 56 |
57 if (enable_noisy_errors_ && be_noisy) { | 57 if (enable_noisy_errors_ && be_noisy) { |
58 platform_util::SimpleErrorBox(NULL, | 58 browser::ShowErrorBox(NULL, |
59 UTF8ToUTF16("Extension error"), | 59 UTF8ToUTF16("Extension error"), |
60 UTF8ToUTF16(message)); | 60 UTF8ToUTF16(message)); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 const std::vector<std::string>* ExtensionErrorReporter::GetErrors() { | 64 const std::vector<std::string>* ExtensionErrorReporter::GetErrors() { |
65 return &errors_; | 65 return &errors_; |
66 } | 66 } |
67 | 67 |
68 void ExtensionErrorReporter::ClearErrors() { | 68 void ExtensionErrorReporter::ClearErrors() { |
69 errors_.clear(); | 69 errors_.clear(); |
70 } | 70 } |
OLD | NEW |