Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/signin/easy_unlock_notification_controller_chromeos.h

Issue 2968323002: [EasyUnlock] Introduce EasyUnlockNotificationController (Closed)
Patch Set: fix unittests Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/signin/easy_unlock_notification_controller.h"
15 #include "ui/message_center/message_center.h"
16 #include "ui/message_center/notification.h"
17 #include "ui/message_center/notification_delegate.h"
18
19 class Profile;
20
21 // Implementation of EasyUnlockNotificationController for ChromeOS.
22 class EasyUnlockNotificationControllerChromeOS
23 : public EasyUnlockNotificationController {
24 public:
25 EasyUnlockNotificationControllerChromeOS(
26 Profile* profile,
27 message_center::MessageCenter* message_center);
28 ~EasyUnlockNotificationControllerChromeOS() override;
29
30 // EasyUnlockNotificationController:
31 void ShowChromebookAddedNotification() override;
32 void ShowPairingChangeNotification() override;
33 void ShowPairingChangeAppliedNotification(
34 const std::string& phone_name) override;
35 void ShowPromotionNotification() override;
36
37 protected:
38 // Exposed for testing
39 virtual void LaunchEasyUnlockSettings();
40 virtual void LockScreen();
41
42 private:
43 // NotificationDelegate implementation for handling click events.
44 class NotificationDelegate : public message_center::NotificationDelegate {
45 public:
46 NotificationDelegate(
47 const std::string& notification_id,
48 const base::WeakPtr<EasyUnlockNotificationControllerChromeOS>&
49 notification_controller);
50
51 // message_center::NotificationDelegate:
52 void Click() override;
53 void ButtonClick(int button_index) override;
54
55 private:
56 ~NotificationDelegate() override;
57
58 std::string notification_id_;
59 base::WeakPtr<EasyUnlockNotificationControllerChromeOS>
60 notification_controller_;
61
62 DISALLOW_COPY_AND_ASSIGN(NotificationDelegate);
63 };
64
65 // Displays the notification to the user.
66 void ShowNotification(
67 std::unique_ptr<message_center::Notification> notification);
68
69 Profile* profile_;
70
71 message_center::MessageCenter* message_center_;
72
73 base::WeakPtrFactory<EasyUnlockNotificationControllerChromeOS>
74 weak_ptr_factory_;
75
76 DISALLOW_COPY_AND_ASSIGN(EasyUnlockNotificationControllerChromeOS);
77 };
78
79 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698