Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/ui/global_error_service.h

Issue 10700027: browser: Move global error to subdir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
6 #define CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
7 #pragma once
8
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h"
13
14 class GlobalError;
15 class Profile;
16
17 // This service manages a list of errors that are meant to be shown globally.
18 // If an error applies to an entire profile and not just to a tab then the
19 // error should be shown using this service. Examples of global errors are:
20 // - the previous session crashed for a given profile.
21 // - a sync error occurred
22 class GlobalErrorService : public ProfileKeyedService {
23 public:
24 // Type used to represent the list of currently active errors.
25 typedef std::vector<GlobalError*> GlobalErrorList;
26
27 // Constructs a GlobalErrorService object for the given profile. The profile
28 // maybe NULL for tests.
29 explicit GlobalErrorService(Profile* profile);
30 virtual ~GlobalErrorService();
31
32 // Adds the given error to the list of global errors and displays it on
33 // browswer windows. If no browser windows are open then the error is
34 // displayed once a browser window is opened. This class takes ownership of
35 // the error.
36 void AddGlobalError(GlobalError* error);
37
38 // Hides the given error and removes it from the list of global errors. Caller
39 // then takes ownership of the error and is responsible for deleting it.
40 void RemoveGlobalError(GlobalError* error);
41
42 // Gets the error with the given command ID or NULL if no such error exists.
43 // This class maintains ownership of the returned error.
44 GlobalError* GetGlobalErrorByMenuItemCommandID(int command_id) const;
45
46 // Gets the badge icon resource ID for the first error with a badge.
47 // Returns 0 if no such error exists.
48 int GetFirstBadgeResourceID() const;
49
50 // Gets the first error that has a bubble view which hasn't been shown yet.
51 // Returns NULL if no such error exists.
52 GlobalError* GetFirstGlobalErrorWithBubbleView() const;
53
54 // Gets all errors.
55 const GlobalErrorList& errors() { return errors_; }
56
57 // Post a notification that a global error has changed and that the error UI
58 // should update it self. Pass NULL for the given error to mean all error UIs
59 // should update.
60 void NotifyErrorsChanged(GlobalError* error);
61
62 private:
63 GlobalErrorList errors_;
64 Profile* profile_;
65
66 DISALLOW_COPY_AND_ASSIGN(GlobalErrorService);
67 };
68
69 #endif // CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/global_error_bubble_view_base.h ('k') | chrome/browser/ui/global_error_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698