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

Side by Side Diff: ui/arc/notification/arc_custom_notification_item.cc

Issue 2547433002: Transfer responsibility for providing a close button for a notification to each implementation of M… (Closed)
Patch Set: WrapUnique -> MakeUnique Created 4 years 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
« no previous file with comments | « no previous file | ui/arc/notification/arc_custom_notification_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/arc/notification/arc_custom_notification_item.h" 5 #include "ui/arc/notification/arc_custom_notification_item.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "ui/arc/notification/arc_custom_notification_view.h" 14 #include "ui/arc/notification/arc_custom_notification_view.h"
15 #include "ui/message_center/notification.h" 15 #include "ui/message_center/notification.h"
16 #include "ui/message_center/notification_types.h" 16 #include "ui/message_center/notification_types.h"
17 #include "ui/message_center/views/custom_notification_content_view_delegate.h"
17 18
18 namespace arc { 19 namespace arc {
19 20
20 namespace { 21 namespace {
21 22
22 constexpr char kNotifierId[] = "ARC_NOTIFICATION"; 23 constexpr char kNotifierId[] = "ARC_NOTIFICATION";
23 24
24 class ArcNotificationDelegate : public message_center::NotificationDelegate { 25 class ArcNotificationDelegate : public message_center::NotificationDelegate {
25 public: 26 public:
26 explicit ArcNotificationDelegate(ArcCustomNotificationItem* item) 27 explicit ArcNotificationDelegate(ArcCustomNotificationItem* item)
27 : item_(item) {} 28 : item_(item) {}
28 29
29 std::unique_ptr<views::View> CreateCustomContent() override { 30 std::unique_ptr<message_center::CustomContent> CreateCustomContent()
30 return base::MakeUnique<ArcCustomNotificationView>(item_); 31 override {
32 auto view = base::MakeUnique<ArcCustomNotificationView>(item_);
33 auto content_view_delegate = view->CreateContentViewDelegate();
34 return base::MakeUnique<message_center::CustomContent>(
35 std::move(view), std::move(content_view_delegate));
31 } 36 }
32 37
33 private: 38 private:
34 // The destructor is private since this class is ref-counted. 39 // The destructor is private since this class is ref-counted.
35 ~ArcNotificationDelegate() override {} 40 ~ArcNotificationDelegate() override {}
36 41
37 ArcCustomNotificationItem* const item_; 42 ArcCustomNotificationItem* const item_;
38 43
39 DISALLOW_COPY_AND_ASSIGN(ArcNotificationDelegate); 44 DISALLOW_COPY_AND_ASSIGN(ArcNotificationDelegate);
40 }; 45 };
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 129 }
125 130
126 void ArcCustomNotificationItem::DecrementWindowRefCount() { 131 void ArcCustomNotificationItem::DecrementWindowRefCount() {
127 DCHECK_GT(window_ref_count_, 0); 132 DCHECK_GT(window_ref_count_, 0);
128 --window_ref_count_; 133 --window_ref_count_;
129 if (window_ref_count_ == 0) 134 if (window_ref_count_ == 0)
130 manager()->CloseNotificationWindow(notification_key()); 135 manager()->CloseNotificationWindow(notification_key());
131 } 136 }
132 137
133 } // namespace arc 138 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | ui/arc/notification/arc_custom_notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698