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

Side by Side Diff: ui/message_center/views/custom_notification_view.cc

Issue 2729533002: Adjust behavior of control buttons of notifications. (Closed)
Patch Set: Add unimplemented method to TestContentViewDelegate Created 3 years, 9 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
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/message_center/views/custom_notification_view.h" 5 #include "ui/message_center/views/custom_notification_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/base/ime/input_method.h" 9 #include "ui/base/ime/input_method.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (contents_view_delegate_) 71 if (contents_view_delegate_)
72 contents_view_delegate_->RequestFocusOnCloseButton(); 72 contents_view_delegate_->RequestFocusOnCloseButton();
73 } 73 }
74 74
75 bool CustomNotificationView::IsPinned() const { 75 bool CustomNotificationView::IsPinned() const {
76 if (!contents_view_delegate_) 76 if (!contents_view_delegate_)
77 return false; 77 return false;
78 return contents_view_delegate_->IsPinned(); 78 return contents_view_delegate_->IsPinned();
79 } 79 }
80 80
81 void CustomNotificationView::UpdateControlButtonsVisibility() {
82 if (contents_view_delegate_)
83 contents_view_delegate_->UpdateControlButtonsVisibility();
84 }
85
81 gfx::Size CustomNotificationView::GetPreferredSize() const { 86 gfx::Size CustomNotificationView::GetPreferredSize() const {
82 const gfx::Insets insets = GetInsets(); 87 const gfx::Insets insets = GetInsets();
83 const int contents_width = kNotificationWidth - insets.width(); 88 const int contents_width = kNotificationWidth - insets.width();
84 const int contents_height = contents_view_->GetHeightForWidth(contents_width); 89 const int contents_height = contents_view_->GetHeightForWidth(contents_width);
85 90
86 // This is union of max/min height for M (256-64) and N (284-92). 91 // This is union of max/min height for M (256-64) and N (284-92).
87 constexpr int kMaxContentHeight = 284; 92 constexpr int kMaxContentHeight = 284;
88 constexpr int kMinContentHeight = 64; 93 constexpr int kMinContentHeight = 64;
89 return gfx::Size(kNotificationWidth, 94 return gfx::Size(kNotificationWidth,
90 std::max(kMinContentHeight + insets.height(), 95 std::max(kMinContentHeight + insets.height(),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 150 }
146 151
147 void CustomNotificationView::ChildPreferredSizeChanged(View* child) { 152 void CustomNotificationView::ChildPreferredSizeChanged(View* child) {
148 // Notify MessageCenterController when the custom content changes size, 153 // Notify MessageCenterController when the custom content changes size,
149 // as it may need to relayout. 154 // as it may need to relayout.
150 if (controller()) 155 if (controller())
151 controller()->UpdateNotificationSize(notification_id()); 156 controller()->UpdateNotificationSize(notification_id());
152 } 157 }
153 158
154 } // namespace message_center 159 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/custom_notification_view.h ('k') | ui/message_center/views/custom_notification_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698