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

Side by Side Diff: chrome/browser/ui/toolbar/app_menu_icon_controller.h

Issue 2039403002: Renamed AppMenuBadgeController to AppMenuIconController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TOOLBAR_APP_MENU_BADGE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ICON_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_BADGE_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ICON_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h" 9 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h"
10 #include "content/public/browser/notification_details.h" 10 #include "content/public/browser/notification_details.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
14 14
15 class Profile; 15 class Profile;
16 16
17 // AppMenuBadgeController encapsulates the logic for badging the app menu icon 17 // AppMenuBadgeController encapsulates the logic for badging the app menu icon
msw 2016/06/07 01:01:38 nit: update all mentions of badge in comments, ple
18 // as a result of various events - such as available updates, errors, etc. 18 // as a result of various events - such as available updates, errors, etc.
19 class AppMenuBadgeController : public content::NotificationObserver { 19 class AppMenuIconController : public content::NotificationObserver {
20 public: 20 public:
21 enum class BadgeType { 21 enum class IconType {
22 NONE, 22 NONE,
23 UPGRADE_NOTIFICATION, 23 UPGRADE_NOTIFICATION,
24 GLOBAL_ERROR, 24 GLOBAL_ERROR,
25 INCOMPATIBILITY_WARNING, 25 INCOMPATIBILITY_WARNING,
26 }; 26 };
27 27
28 // Delegate interface for receiving badge update notifications. 28 // Delegate interface for receiving badge update notifications.
29 class Delegate { 29 class Delegate {
30 public: 30 public:
31 // Notifies the UI to update the badge to have the specified |severity|, as 31 // Notifies the UI to update the badge to have the specified |severity|, as
32 // well as specifying whether it should |animate|. The |type| parameter 32 // well as specifying whether it should |animate|. The |type| parameter
33 // specifies the type of change (i.e. the source of the notification). 33 // specifies the type of change (i.e. the source of the notification).
34 virtual void UpdateBadgeSeverity(BadgeType type, 34 virtual void UpdateIconSeverity(IconType type,
35 AppMenuIconPainter::Severity severity, 35 AppMenuIconPainter::Severity severity,
36 bool animate) = 0; 36 bool animate) = 0;
37 37
38 protected: 38 protected:
39 virtual ~Delegate() {} 39 virtual ~Delegate() {}
40 }; 40 };
41 41
42 // Creates an instance of this class for the given |profile| that will notify 42 // Creates an instance of this class for the given |profile| that will notify
43 // |delegate| of updates. 43 // |delegate| of updates.
44 AppMenuBadgeController(Profile* profile, Delegate* delegate); 44 AppMenuIconController(Profile* profile, Delegate* delegate);
45 ~AppMenuBadgeController() override; 45 ~AppMenuIconController() override;
46 46
47 // Forces an update of the UI based on the current state of the world. This 47 // Forces an update of the UI based on the current state of the world. This
48 // will check whether there are any current pending updates, global errors, 48 // will check whether there are any current pending updates, global errors,
49 // etc. and based on that information trigger an appropriate call to the 49 // etc. and based on that information trigger an appropriate call to the
50 // delegate. 50 // delegate.
51 void UpdateDelegate(); 51 void UpdateDelegate();
52 52
53 private: 53 private:
54 // content::NotificationObserver: 54 // content::NotificationObserver:
55 void Observe(int type, 55 void Observe(int type,
56 const content::NotificationSource& source, 56 const content::NotificationSource& source,
57 const content::NotificationDetails& details) override; 57 const content::NotificationDetails& details) override;
58 58
59 Profile* profile_; 59 Profile* profile_;
60 Delegate* delegate_; 60 Delegate* delegate_;
61 content::NotificationRegistrar registrar_; 61 content::NotificationRegistrar registrar_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(AppMenuBadgeController); 63 DISALLOW_COPY_AND_ASSIGN(AppMenuIconController);
64 }; 64 };
65 65
66 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_BADGE_CONTROLLER_H_ 66 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ICON_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698