| OLD | NEW |
| (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_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "chrome/browser/extensions/extension_warning_set.h" |
| 11 |
| 12 // TODO(battre): Rename ExtensionWarningBadgeService to WarningBadgeService. |
| 13 |
| 14 class Profile; |
| 15 |
| 16 namespace extensions { |
| 17 |
| 18 // A service that is responsible for showing an extension warning badge on the |
| 19 // wrench menu. |
| 20 class ExtensionWarningBadgeService : public ExtensionWarningSet::Observer, |
| 21 public base::NonThreadSafe { |
| 22 public: |
| 23 explicit ExtensionWarningBadgeService(Profile* profile); |
| 24 virtual ~ExtensionWarningBadgeService(); |
| 25 |
| 26 // Black lists all currently active extension warnings, so that they do not |
| 27 // trigger a warning badge again for the life-time of the browsing session. |
| 28 void SuppressCurrentWarnings(); |
| 29 |
| 30 protected: |
| 31 // Virtual for testing. |
| 32 virtual const std::set<ExtensionWarning>& GetCurrentWarnings() const; |
| 33 |
| 34 private: |
| 35 // Implementation of ExtensionWarningSet::Observer. |
| 36 virtual void ExtensionWarningsChanged() OVERRIDE; |
| 37 |
| 38 void UpdateBadgeStatus(); |
| 39 virtual void ShowBadge(bool show); |
| 40 |
| 41 Profile* profile_; |
| 42 |
| 43 // Warnings that do not trigger a badge on the wrench menu. |
| 44 std::set<ExtensionWarning> suppressed_warnings_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ExtensionWarningBadgeService); |
| 47 }; |
| 48 |
| 49 } // namespace extensions |
| 50 |
| 51 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_ |
| OLD | NEW |