Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / notifications / login_state_notification_blocker_chromeos.h
blob12767f2f767e645b804d0a448597a819d20e08ea
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_LOGIN_STATE_NOTIFICATION_BLOCKER_CHROMEOS_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_LOGIN_STATE_NOTIFICATION_BLOCKER_CHROMEOS_H_
8 #include "ash/shell_observer.h"
9 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
10 #include "chromeos/login/login_state.h"
11 #include "ui/message_center/notification_blocker.h"
13 // A notification blocker which checks screen lock / login state for ChromeOS.
14 // This is different from ScreenLockNotificationBlocker because:
15 // - ScreenLockNotificationBlocker only cares about lock status but ChromeOS
16 // needs to care about login-screen.
17 // - ScreenLockNotificationBlocker needs a timer to check the screen lock state
18 // periodically, but ash::ShellObserver gets the events directly in ChromeOS.
19 // - In ChromeOS, some system notifications are allowed to be shown as popups.
20 class LoginStateNotificationBlockerChromeOS
21 : public message_center::NotificationBlocker,
22 public ash::ShellObserver,
23 public chromeos::LoginState::Observer,
24 public chromeos::UserAddingScreen::Observer {
25 public:
26 explicit LoginStateNotificationBlockerChromeOS(
27 message_center::MessageCenter* message_center);
28 ~LoginStateNotificationBlockerChromeOS() override;
30 private:
31 // message_center::NotificationBlocker overrides:
32 bool ShouldShowNotificationAsPopup(
33 const message_center::NotifierId& notifier_id) const override;
35 // ash::ShellObserver overrides:
36 void OnLockStateChanged(bool locked) override;
37 void OnAppTerminating() override;
39 // chromeos::LoginState::Observer overrides:
40 void LoggedInStateChanged() override;
42 // chromeos::UserAddingScreen::Observer overrides:
43 void OnUserAddingStarted() override;
44 void OnUserAddingFinished() override;
46 bool locked_;
47 bool observing_;
49 DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerChromeOS);
52 #endif // CHROME_BROWSER_NOTIFICATIONS_LOGIN_STATE_NOTIFICATION_BLOCKER_CHROMEOS_H_