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

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

Issue 2845003002: Merge ArcNotificationItem and ArcCustomNotificationItem (Closed)
Patch Set: Created 3 years, 8 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 57%
copy from ui/arc/notification/arc_notification_item.h
copy to ui/arc/notification/arc_notification_item_impl.h
index 555225c2b316be66c546e27aeb844ff5310748e0..1c7a18da43415ba338fd4aae0d21c8e1d94a53cb 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>
@@ -11,9 +11,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
-#include "components/arc/common/notifications.mojom.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"
@@ -21,34 +21,38 @@ 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();
-
- virtual void UpdateWithArcNotificationData(
- mojom::ArcNotificationDataPtr data);
-
- // Methods called from ArcNotificationManager:
- void OnClosedFromAndroid();
-
- // Methods called from ArcNotificationItemDelegate:
- void Close(bool by_user);
- void Click();
- void ButtonClick(int button_index);
- void OpenSettings();
- bool IsOpeningSettingsSupported() const;
- void ToggleExpansion();
-
- const std::string& notification_key() const { return notification_key_; }
+ ArcNotificationItemImpl(ArcNotificationManager* manager,
+ message_center::MessageCenter* message_center,
+ const std::string& notification_key,
+ const AccountId& profile_id);
+ ~ArcNotificationItemImpl() override;
+
+ void UpdateWithArcNotificationData(
+ mojom::ArcNotificationDataPtr data) override;
+
+ void OnClosedFromAndroid() override;
hidehiko 2017/05/01 12:29:18 // ArcNotificationItem overrides:
yoshiki 2017/05/08 06:24:53 Done.
+ void Close(bool by_user) override;
+ void Click() override;
+ void CloseFromCloseButton() override;
+ void OpenSettings() override;
+ bool IsOpeningSettingsSupported() const override;
+ void ToggleExpansion() override;
+
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
+
+ void IncrementWindowRefCount() override;
+ void DecrementWindowRefCount() override;
+
+ bool GetPinned() const override;
+ const gfx::ImageSkia& GetSnapshot() const override;
+ mojom::ArcNotificationExpandState GetExpandState() const override;
+ mojom::ArcNotificationShownContents GetShownContents() const override;
+ const std::string& GetNotificationKey() const override;
protected:
hidehiko 2017/05/01 12:29:18 Because ArcNotificationItemImpl is no longer inher
yoshiki 2017/05/08 06:24:53 Done.
- static int ConvertAndroidPriority(
- mojom::ArcNotificationPriority android_priority);
-
// Checks whether there is on-going |notification_|.
hidehiko 2017/05/01 12:29:18 (optional): Also, several util functions can be in
yoshiki 2017/05/08 06:24:53 Removed unnecessary util methods
bool HasPendingNotification();
// Cache the |data| in |newer_data_|.
@@ -80,6 +84,16 @@ class ArcNotificationItem {
message_center::MessageCenter* const message_center_;
const AccountId profile_id_;
+ bool pinned_ = false;
hidehiko 2017/05/01 12:29:18 Comments for each field, please?
yoshiki 2017/05/08 06:24:53 Done.
+ gfx::ImageSkia snapshot_;
+ mojom::ArcNotificationExpandState expand_state_ =
+ mojom::ArcNotificationExpandState::FIXED_SIZE;
+ mojom::ArcNotificationShownContents shown_contents_ =
+ mojom::ArcNotificationShownContents::CONTENTS_SHOWN;
+ int window_ref_count_ = 0;
+
+ base::ObserverList<Observer> observers_;
hidehiko 2017/05/01 12:29:18 include base/observer_list.h ?
yoshiki 2017/05/08 06:24:53 Done.
+
const std::string notification_key_;
const std::string notification_id_;
@@ -100,11 +114,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