| OLD | NEW |
| 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 public: | 26 public: |
| 27 // Initializes the error reporter. Must be called before any other methods | 27 // Initializes the error reporter. Must be called before any other methods |
| 28 // and on the UI thread. | 28 // and on the UI thread. |
| 29 static void Init(bool enable_noisy_errors); | 29 static void Init(bool enable_noisy_errors); |
| 30 | 30 |
| 31 // Get the singleton instance. | 31 // Get the singleton instance. |
| 32 static ExtensionErrorReporter* GetInstance(); | 32 static ExtensionErrorReporter* GetInstance(); |
| 33 | 33 |
| 34 // Report an error. Errors always go to VLOG(1). Optionally, they can also | 34 // Report an error. Errors always go to VLOG(1). Optionally, they can also |
| 35 // cause a noisy alert box. | 35 // cause a noisy alert box. |
| 36 // | 36 void ReportError(const base::string16& message, bool be_noisy); |
| 37 // If |user_response| is non-NULL and |be_noisy| is true (and the | |
| 38 // ErrorReporter hasn't turned off noisy errors), the user will be asked if | |
| 39 // they want to retry and the answer noted in |user_response|. | |
| 40 void ReportError(const base::string16& message, | |
| 41 bool be_noisy, | |
| 42 bool* user_response); | |
| 43 | 37 |
| 44 // Get the errors that have been reported so far. | 38 // Get the errors that have been reported so far. |
| 45 const std::vector<base::string16>* GetErrors(); | 39 const std::vector<base::string16>* GetErrors(); |
| 46 | 40 |
| 47 // Clear the list of errors reported so far. | 41 // Clear the list of errors reported so far. |
| 48 void ClearErrors(); | 42 void ClearErrors(); |
| 49 | 43 |
| 50 private: | 44 private: |
| 51 static ExtensionErrorReporter* instance_; | 45 static ExtensionErrorReporter* instance_; |
| 52 | 46 |
| 53 explicit ExtensionErrorReporter(bool enable_noisy_errors); | 47 explicit ExtensionErrorReporter(bool enable_noisy_errors); |
| 54 ~ExtensionErrorReporter(); | 48 ~ExtensionErrorReporter(); |
| 55 | 49 |
| 56 base::MessageLoop* ui_loop_; | 50 base::MessageLoop* ui_loop_; |
| 57 std::vector<base::string16> errors_; | 51 std::vector<base::string16> errors_; |
| 58 bool enable_noisy_errors_; | 52 bool enable_noisy_errors_; |
| 59 }; | 53 }; |
| 60 | 54 |
| 61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ |
| OLD | NEW |