OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_WARNING_BADGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/sequence_checker.h" |
11 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
12 #include "extensions/browser/warning_service.h" | 12 #include "extensions/browser/warning_service.h" |
13 #include "extensions/browser/warning_set.h" | 13 #include "extensions/browser/warning_set.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // A service that is responsible for showing an extension warning badge on the | 19 // A service that is responsible for showing an extension warning badge on the |
20 // wrench menu. | 20 // wrench menu. |
21 class WarningBadgeService : public KeyedService, | 21 class WarningBadgeService : public KeyedService, |
22 public WarningService::Observer, | 22 public WarningService::Observer { |
23 public base::NonThreadSafe { | |
24 public: | 23 public: |
25 explicit WarningBadgeService(Profile* profile); | 24 explicit WarningBadgeService(Profile* profile); |
26 ~WarningBadgeService() override; | 25 ~WarningBadgeService() override; |
27 | 26 |
28 static WarningBadgeService* Get(content::BrowserContext* context); | 27 static WarningBadgeService* Get(content::BrowserContext* context); |
29 | 28 |
30 // Black lists all currently active extension warnings, so that they do not | 29 // Black lists all currently active extension warnings, so that they do not |
31 // trigger a warning badge again for the life-time of the browsing session. | 30 // trigger a warning badge again for the life-time of the browsing session. |
32 void SuppressCurrentWarnings(); | 31 void SuppressCurrentWarnings(); |
33 | 32 |
(...skipping 10 matching lines...) Expand all Loading... | |
44 virtual void ShowBadge(bool show); | 43 virtual void ShowBadge(bool show); |
45 | 44 |
46 Profile* profile_; | 45 Profile* profile_; |
47 | 46 |
48 ScopedObserver<WarningService, WarningService::Observer> | 47 ScopedObserver<WarningService, WarningService::Observer> |
49 warning_service_observer_; | 48 warning_service_observer_; |
50 | 49 |
51 // Warnings that do not trigger a badge on the wrench menu. | 50 // Warnings that do not trigger a badge on the wrench menu. |
52 WarningSet suppressed_warnings_; | 51 WarningSet suppressed_warnings_; |
53 | 52 |
53 SEQUENCE_CHECKER(sequence_checker_); | |
Devlin
2017/05/30 20:04:25
This class should only ever be used on the UI thre
gab
2017/05/31 16:36:24
Done.
| |
54 | |
54 DISALLOW_COPY_AND_ASSIGN(WarningBadgeService); | 55 DISALLOW_COPY_AND_ASSIGN(WarningBadgeService); |
55 }; | 56 }; |
56 | 57 |
57 } // namespace extensions | 58 } // namespace extensions |
58 | 59 |
59 #endif // CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_H_ | 60 #endif // CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_H_ |
OLD | NEW |