blob: c1887b411e6e019e9ce7152faf71f4b5e6c87a53 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_
#include "base/compiler_specific.h"
#include "base/threading/non_thread_safe.h"
#include "extensions/browser/warning_service.h"
#include "extensions/browser/warning_set.h"
// TODO(battre): Rename ExtensionWarningBadgeService to WarningBadgeService.
class Profile;
namespace extensions {
// A service that is responsible for showing an extension warning badge on the
// wrench menu.
class ExtensionWarningBadgeService : public WarningService::Observer,
public base::NonThreadSafe {
public:
explicit ExtensionWarningBadgeService(Profile* profile);
virtual ~ExtensionWarningBadgeService();
// Black lists all currently active extension warnings, so that they do not
// trigger a warning badge again for the life-time of the browsing session.
void SuppressCurrentWarnings();
protected:
// Virtual for testing.
virtual const std::set<Warning>& GetCurrentWarnings() const;
private:
// Implementation of WarningService::Observer.
void ExtensionWarningsChanged() override;
void UpdateBadgeStatus();
virtual void ShowBadge(bool show);
Profile* profile_;
// Warnings that do not trigger a badge on the wrench menu.
WarningSet suppressed_warnings_;
DISALLOW_COPY_AND_ASSIGN(ExtensionWarningBadgeService);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_BADGE_SERVICE_H_