Index: chrome/browser/ui/global_error_service.h |
diff --git a/chrome/browser/ui/global_error_service.h b/chrome/browser/ui/global_error_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ac8edebfe63aed81e655ed328ea7f810f9f4782 |
--- /dev/null |
+++ b/chrome/browser/ui/global_error_service.h |
@@ -0,0 +1,41 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_ |
+#define CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_ |
+#pragma once |
+ |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "chrome/browser/profiles/profile_keyed_service.h" |
+ |
+class GlobalErrorDelegate; |
+ |
+// This service manages a list of errors that are meant to be shown globally. |
+// If an error applies to an entire profile and not just to a tab then the |
+// error should be shown using this service. Examples of global errors are: |
+// - the previous session crashed for a given profile. |
+// - a sync error occurred |
+class GlobalErrorService : public ProfileKeyedService { |
+ public: |
+ GlobalErrorService(); |
+ ~GlobalErrorService(); |
+ |
+ // This class takes ownership of the delegate. |
+ void AddGlobalError(GlobalErrorDelegate* delegate); |
+ |
+ // Removes the delegate. Caller then takes ownership of the delegate and is |
+ // responsible for deleting it. |
+ void RemoveGlobalError(GlobalErrorDelegate* delegate); |
+ |
+ const std::vector<GlobalErrorDelegate*>& GetErrorDelegates(); |
+ |
+ private: |
+ std::vector<GlobalErrorDelegate*> errors_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GlobalErrorService); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_ |