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

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

Issue 7948003: Update error badge on wrench menu button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 years, 3 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
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_UI_GLOBAL_ERROR_SERVICE_H_ 5 #ifndef CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
6 #define CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_ 6 #define CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h" 12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 13
14 class GlobalError; 14 class GlobalError;
15 class Profile;
15 16
16 // This service manages a list of errors that are meant to be shown globally. 17 // This service manages a list of errors that are meant to be shown globally.
17 // If an error applies to an entire profile and not just to a tab then the 18 // If an error applies to an entire profile and not just to a tab then the
18 // error should be shown using this service. Examples of global errors are: 19 // error should be shown using this service. Examples of global errors are:
19 // - the previous session crashed for a given profile. 20 // - the previous session crashed for a given profile.
20 // - a sync error occurred 21 // - a sync error occurred
21 class GlobalErrorService : public ProfileKeyedService { 22 class GlobalErrorService : public ProfileKeyedService {
22 public: 23 public:
23 GlobalErrorService(); 24 // Constructs a GlobalErrorService object for the given profile. The profile
25 // maybe NULL for tests.
26 explicit GlobalErrorService(Profile* profile);
24 virtual ~GlobalErrorService(); 27 virtual ~GlobalErrorService();
25 28
26 // Adds the given error to the list of global errors and displays it on 29 // Adds the given error to the list of global errors and displays it on
27 // browswer windows. If no browser windows are open then the error is 30 // browswer windows. If no browser windows are open then the error is
28 // displayed once a browser window is opened. This class takes ownership of 31 // displayed once a browser window is opened. This class takes ownership of
29 // the error. 32 // the error.
30 void AddGlobalError(GlobalError* error); 33 void AddGlobalError(GlobalError* error);
31 34
32 // Hides the given error and removes it from the list of global errors. Caller 35 // Hides the given error and removes it from the list of global errors. Caller
33 // then takes ownership of the error and is responsible for deleting it. 36 // then takes ownership of the error and is responsible for deleting it.
34 void RemoveGlobalError(GlobalError* error); 37 void RemoveGlobalError(GlobalError* error);
35 38
36 // Gets the error with the given command ID or NULL if no such error exists. 39 // Gets the error with the given command ID or NULL if no such error exists.
37 // This class maintains ownership of the returned error. 40 // This class maintains ownership of the returned error.
38 GlobalError* GetGlobalErrorByMenuItemCommandID(int command_id) const; 41 GlobalError* GetGlobalErrorByMenuItemCommandID(int command_id) const;
39 42
40 // Gets the badge icon resource ID for the first error with a badge. 43 // Gets the badge icon resource ID for the first error with a badge.
41 // Returns 0 if no such error exists. 44 // Returns 0 if no such error exists.
42 int GetFirstBadgeResourceID() const; 45 int GetFirstBadgeResourceID() const;
43 46
44 // Gets the first error that has a bubble view which hasn't been shown yet. 47 // Gets the first error that has a bubble view which hasn't been shown yet.
45 // Returns NULL if no such error exists. 48 // Returns NULL if no such error exists.
46 GlobalError* GetFirstGlobalErrorWithBubbleView() const; 49 GlobalError* GetFirstGlobalErrorWithBubbleView() const;
47 50
48 // Gets all errors. 51 // Gets all errors.
49 const std::vector<GlobalError*>& errors() { return errors_; } 52 const std::vector<GlobalError*>& errors() { return errors_; }
50 53
54 // Post a notification that a global error has changed and that the error UI
55 // should update it self. Pass NULL for the given error to mean all error UIs
56 // should update.
57 void NotifyErrorsChanged(GlobalError* error);
58
51 private: 59 private:
52 std::vector<GlobalError*> errors_; 60 std::vector<GlobalError*> errors_;
61 Profile* profile_;
53 62
54 DISALLOW_COPY_AND_ASSIGN(GlobalErrorService); 63 DISALLOW_COPY_AND_ASSIGN(GlobalErrorService);
55 }; 64 };
56 65
57 #endif // CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_ 66 #endif // CHROME_BROWSER_UI_GLOBAL_ERROR_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm ('k') | chrome/browser/ui/global_error_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698