Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / notifications / screen_lock_notification_blocker.h
blob698ba2896adf7199aa1fabfd2c04572c957ed5ff
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_SCREEN_LOCK_NOTIFICATION_BLOCKER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_SCREEN_LOCK_NOTIFICATION_BLOCKER_H_
8 #include "base/basictypes.h"
9 #include "base/observer_list.h"
10 #include "base/timer/timer.h"
11 #include "ui/message_center/notification_blocker.h"
13 // A notification blocker which checks the screen lock state constantly.
14 class ScreenLockNotificationBlocker
15 : public message_center::NotificationBlocker {
16 public:
17 explicit ScreenLockNotificationBlocker(
18 message_center::MessageCenter* message_center);
19 ~ScreenLockNotificationBlocker() override;
21 bool is_locked() const { return is_locked_; }
23 // message_center::NotificationBlocker overrides:
24 void CheckState() override;
25 bool ShouldShowNotificationAsPopup(
26 const message_center::NotifierId& notifier_id) const override;
28 private:
29 bool is_locked_;
31 base::OneShotTimer<ScreenLockNotificationBlocker> timer_;
33 DISALLOW_COPY_AND_ASSIGN(ScreenLockNotificationBlocker);
36 #endif // CHROME_BROWSER_NOTIFICATIONS_SCREEN_LOCK_NOTIFICATION_BLOCKER_H_