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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/easy_unlock_notification_controller_chromeos.h
diff --git a/chrome/browser/signin/easy_unlock_notification_controller_chromeos.h b/chrome/browser/signin/easy_unlock_notification_controller_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..3014e2d086647b3670637337dc3498e36caa89a7
--- /dev/null
+++ b/chrome/browser/signin/easy_unlock_notification_controller_chromeos.h
@@ -0,0 +1,79 @@
+// Copyright 2017 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_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
+#define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_
+
+#include <memory>
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/signin/easy_unlock_notification_controller.h"
+#include "ui/message_center/message_center.h"
+#include "ui/message_center/notification.h"
+#include "ui/message_center/notification_delegate.h"
+
+class Profile;
+
+// Implementation of EasyUnlockNotificationController for ChromeOS.
+class EasyUnlockNotificationControllerChromeOS
+ : public EasyUnlockNotificationController {
+ public:
+ EasyUnlockNotificationControllerChromeOS(
+ Profile* profile,
+ message_center::MessageCenter* message_center);
+ ~EasyUnlockNotificationControllerChromeOS() override;
+
+ // EasyUnlockNotificationController:
+ void ShowChromebookAddedNotification() override;
+ void ShowPairingChangeNotification() override;
+ void ShowPairingChangeAppliedNotification(
+ const std::string& phone_name) override;
+ void ShowPromotionNotification() override;
+
+ protected:
+ // Exposed for testing
+ virtual void LaunchEasyUnlockSettings();
+ virtual void LockScreen();
+
+ private:
+ // NotificationDelegate implementation for handling click events.
+ class NotificationDelegate : public message_center::NotificationDelegate {
+ public:
+ NotificationDelegate(
+ const std::string& notification_id,
+ const base::WeakPtr<EasyUnlockNotificationControllerChromeOS>&
+ notification_controller);
+
+ // message_center::NotificationDelegate:
+ void Click() override;
+ void ButtonClick(int button_index) override;
+
+ private:
+ ~NotificationDelegate() override;
+
+ std::string notification_id_;
+ base::WeakPtr<EasyUnlockNotificationControllerChromeOS>
+ notification_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationDelegate);
+ };
+
+ // Displays the notification to the user.
+ void ShowNotification(
+ std::unique_ptr<message_center::Notification> notification);
+
+ Profile* profile_;
+
+ message_center::MessageCenter* message_center_;
+
+ base::WeakPtrFactory<EasyUnlockNotificationControllerChromeOS>
+ weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(EasyUnlockNotificationControllerChromeOS);
+};
+
+#endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_NOTIFICATION_CONTROLLER_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698