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

Unified Diff: ui/arc/notification/arc_notification_item_impl.h

Issue 2723143002: Add unittests of ArcCustomNotificationView (Closed)
Patch Set: Created 3 years, 10 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: ui/arc/notification/arc_notification_item_impl.h
diff --git a/ui/arc/notification/arc_notification_item.h b/ui/arc/notification/arc_notification_item_impl.h
similarity index 64%
copy from ui/arc/notification/arc_notification_item.h
copy to ui/arc/notification/arc_notification_item_impl.h
index 3df5e6aaed430ea60574cbbee2f3272f9408389c..5111ef0c28e0094653d6d63c85d1e0156f875664 100644
--- a/ui/arc/notification/arc_notification_item.h
+++ b/ui/arc/notification/arc_notification_item_impl.h
@@ -1,9 +1,9 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// 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 UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_
-#define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_
+#ifndef UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_IMPL_H_
+#define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_IMPL_H_
#include <memory>
#include <string>
@@ -13,6 +13,7 @@
#include "base/threading/thread_checker.h"
#include "components/signin/core/account_id/account_id.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/arc/notification/arc_notification_item.h"
#include "ui/arc/notification/arc_notification_manager.h"
#include "ui/message_center/message_center.h"
@@ -20,27 +21,31 @@ namespace arc {
// The class represents each ARC notification. One instance of this class
// corresponds to one ARC notification.
-class ArcNotificationItem {
+class ArcNotificationItemImpl : public ArcNotificationItem {
public:
- ArcNotificationItem(ArcNotificationManager* manager,
- message_center::MessageCenter* message_center,
- const std::string& notification_key,
- const AccountId& profile_id);
- virtual ~ArcNotificationItem();
+ ArcNotificationItemImpl(ArcNotificationManager* manager,
+ message_center::MessageCenter* message_center,
+ const std::string& notification_key,
+ const AccountId& profile_id);
+ ~ArcNotificationItemImpl() override;
- virtual void UpdateWithArcNotificationData(
- mojom::ArcNotificationDataPtr data);
+ void UpdateWithArcNotificationData(
+ mojom::ArcNotificationDataPtr data) override;
- // Methods called from ArcNotificationManager:
- void OnClosedFromAndroid();
+ void OnClosedFromAndroid() override;
+ void Close(bool by_user) override;
+ void CloseFromCloseButton() override;
+ void OpenSettings() override;
- // Methods called from ArcNotificationItemDelegate:
- void Close(bool by_user);
- void Click();
- void ButtonClick(int button_index);
- void OpenSettings();
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
- const std::string& notification_key() const { return notification_key_; }
+ void IncrementWindowRefCount() override;
+ void DecrementWindowRefCount() override;
+
+ bool pinned() const override;
+ const gfx::ImageSkia& snapshot() const override;
+ const std::string& notification_key() const override;
protected:
static int ConvertAndroidPriority(int android_priority);
@@ -76,6 +81,12 @@ class ArcNotificationItem {
message_center::MessageCenter* const message_center_;
const AccountId profile_id_;
+ bool pinned_ = false;
+ gfx::ImageSkia snapshot_;
+ int window_ref_count_ = 0;
+
+ base::ObserverList<Observer> observers_;
+
const std::string notification_key_;
const std::string notification_id_;
@@ -96,11 +107,11 @@ class ArcNotificationItem {
mojom::ArcNotificationDataPtr newer_data_;
base::ThreadChecker thread_checker_;
- base::WeakPtrFactory<ArcNotificationItem> weak_ptr_factory_;
+ base::WeakPtrFactory<ArcNotificationItemImpl> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ArcNotificationItem);
+ DISALLOW_COPY_AND_ASSIGN(ArcNotificationItemImpl);
};
} // namespace arc
-#endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_ITEM_H_
+#endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_IMPL_ITEM_H_

Powered by Google App Engine
This is Rietveld 408576698