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

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

Issue 2968323002: [EasyUnlock] Introduce EasyUnlockNotificationController (Closed)
Patch Set: use delegate instead of mc observer 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
36 protected:
37 // Exposed for testing
38 virtual void LaunchEasyUnlockSettings();
39 virtual void LockScreen();
40
41 private:
42 // NotificationDelegate implementation for handling click events.
43 class NotificationDelegate : public message_center::NotificationDelegate {
44 public:
45 NotificationDelegate(
46 const std::string& notification_id,
47 const base::WeakPtr<EasyUnlockNotificationControllerChromeOS>&
48 notification_controller);
49
50 // message_center::NotificationDelegate:
51 void Click() override;
52 void ButtonClick(int button_index) override;
53
54 private:
55 ~NotificationDelegate() override;
56
57 std::string notification_id_;
58 base::WeakPtr<EasyUnlockNotificationControllerChromeOS>
59 notification_controller_;
60
61 DISALLOW_COPY_AND_ASSIGN(NotificationDelegate);
62 };
63
64 // Displays the notification to the user.
65 void ShowNotification(
66 std::unique_ptr<message_center::Notification> notification);
67
68 Profile* profile_;
69
70 message_center::MessageCenter* message_center_;
71
72 base::WeakPtrFactory<EasyUnlockNotificationControllerChromeOS>
73 weak_ptr_factory_;
74
75 DISALLOW_COPY_AND_ASSIGN(EasyUnlockNotificationControllerChromeOS);
76 };
77
78 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698