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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // sending an EXTENSION_LOAD_ERROR notification. | 52 // sending an EXTENSION_LOAD_ERROR notification. |
53 // TODO(rdevlin.cronin): There's a lot wrong with this. But some of our | 53 // TODO(rdevlin.cronin): There's a lot wrong with this. But some of our |
54 // systems rely on the notification. Investigate what it will take to remove | 54 // systems rely on the notification. Investigate what it will take to remove |
55 // the notification and this method. | 55 // the notification and this method. |
56 void ReportLoadError(const base::FilePath& extension_path, | 56 void ReportLoadError(const base::FilePath& extension_path, |
57 const std::string& error, | 57 const std::string& error, |
58 content::BrowserContext* browser_context, | 58 content::BrowserContext* browser_context, |
59 bool be_noisy); | 59 bool be_noisy); |
60 | 60 |
61 // Report an error. Errors always go to VLOG(1). Optionally, they can also | 61 // Report an error. Errors always go to VLOG(1). Optionally, they can also |
62 // cause a noisy alert box. | 62 // cause a noisy alert box. Showing the alert box will be postponed until |
| 63 // profile initialization is finished. |
63 void ReportError(const base::string16& message, bool be_noisy); | 64 void ReportError(const base::string16& message, bool be_noisy); |
64 | 65 |
| 66 // Called after the profile is initialized. If there are any postponed alert |
| 67 // boxes, they will be shown at this point. |
| 68 void OnProfileInitialized(); |
| 69 |
65 // Get the errors that have been reported so far. | 70 // Get the errors that have been reported so far. |
66 const std::vector<base::string16>* GetErrors(); | 71 const std::vector<base::string16>* GetErrors(); |
67 | 72 |
68 // Clear the list of errors reported so far. | 73 // Clear the list of errors reported so far. |
69 void ClearErrors(); | 74 void ClearErrors(); |
70 | 75 |
71 void AddObserver(Observer* observer); | 76 void AddObserver(Observer* observer); |
72 | 77 |
73 void RemoveObserver(Observer* observer); | 78 void RemoveObserver(Observer* observer); |
74 | 79 |
75 private: | 80 private: |
76 static ExtensionErrorReporter* instance_; | 81 static ExtensionErrorReporter* instance_; |
77 | 82 |
78 explicit ExtensionErrorReporter(bool enable_noisy_errors); | 83 explicit ExtensionErrorReporter(bool enable_noisy_errors); |
79 ~ExtensionErrorReporter(); | 84 ~ExtensionErrorReporter(); |
80 | 85 |
81 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 86 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
82 std::vector<base::string16> errors_; | 87 std::vector<base::string16> errors_; |
| 88 std::vector<base::string16> postponed_messages_; |
83 bool enable_noisy_errors_; | 89 bool enable_noisy_errors_; |
| 90 bool profile_initialized_ = false; |
84 | 91 |
85 base::ObserverList<Observer> observers_; | 92 base::ObserverList<Observer> observers_; |
86 }; | 93 }; |
87 | 94 |
88 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_REPORTER_H_ |
OLD | NEW |