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

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

Issue 2970953002: Revert of Use shared NotificationControlButtonsView for non-arc notification buttons (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/gfx/skia_util.h" 22 #include "ui/gfx/skia_util.h"
23 #include "ui/gfx/text_elider.h" 23 #include "ui/gfx/text_elider.h"
24 #include "ui/message_center/message_center.h" 24 #include "ui/message_center/message_center.h"
25 #include "ui/message_center/message_center_style.h" 25 #include "ui/message_center/message_center_style.h"
26 #include "ui/message_center/notification.h" 26 #include "ui/message_center/notification.h"
27 #include "ui/message_center/notification_types.h" 27 #include "ui/message_center/notification_types.h"
28 #include "ui/message_center/views/bounded_label.h" 28 #include "ui/message_center/views/bounded_label.h"
29 #include "ui/message_center/views/constants.h" 29 #include "ui/message_center/views/constants.h"
30 #include "ui/message_center/views/message_center_controller.h" 30 #include "ui/message_center/views/message_center_controller.h"
31 #include "ui/message_center/views/notification_button.h" 31 #include "ui/message_center/views/notification_button.h"
32 #include "ui/message_center/views/notification_control_buttons_view.h"
33 #include "ui/message_center/views/padded_button.h" 32 #include "ui/message_center/views/padded_button.h"
34 #include "ui/message_center/views/proportional_image_view.h" 33 #include "ui/message_center/views/proportional_image_view.h"
35 #include "ui/native_theme/native_theme.h" 34 #include "ui/native_theme/native_theme.h"
36 #include "ui/strings/grit/ui_strings.h" 35 #include "ui/strings/grit/ui_strings.h"
37 #include "ui/views/background.h" 36 #include "ui/views/background.h"
38 #include "ui/views/border.h" 37 #include "ui/views/border.h"
39 #include "ui/views/controls/button/image_button.h" 38 #include "ui/views/controls/button/image_button.h"
40 #include "ui/views/controls/image_view.h" 39 #include "ui/views/controls/image_view.h"
41 #include "ui/views/controls/label.h" 40 #include "ui/views/controls/label.h"
42 #include "ui/views/controls/progress_bar.h" 41 #include "ui/views/controls/progress_bar.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 for (int i = 0; i < child_count(); ++i) 133 for (int i = 0; i < child_count(); ++i)
135 child_at(i)->SetVisible(visible); 134 child_at(i)->SetVisible(visible);
136 } 135 }
137 136
138 } // namespace 137 } // namespace
139 138
140 namespace message_center { 139 namespace message_center {
141 140
142 // NotificationView //////////////////////////////////////////////////////////// 141 // NotificationView ////////////////////////////////////////////////////////////
143 142
143 views::View* NotificationView::TargetForRect(views::View* root,
144 const gfx::Rect& rect) {
145 CHECK_EQ(root, this);
146
147 // TODO(tdanderson): Modify this function to support rect-based event
148 // targeting. Using the center point of |rect| preserves this function's
149 // expected behavior for the time being.
150 gfx::Point point = rect.CenterPoint();
151
152 // Want to return this for underlying views, otherwise GetCursor is not
153 // called. But buttons are exceptions, they'll have their own event handlings.
154 std::vector<views::View*> buttons(action_buttons_.begin(),
155 action_buttons_.end());
156 if (settings_button_view_)
157 buttons.push_back(settings_button_view_);
158 if (close_button())
159 buttons.push_back(close_button());
160
161 for (size_t i = 0; i < buttons.size(); ++i) {
162 gfx::Point point_in_child = point;
163 ConvertPointToTarget(this, buttons[i], &point_in_child);
164 if (buttons[i]->HitTestPoint(point_in_child))
165 return buttons[i]->GetEventHandlerForPoint(point_in_child);
166 }
167
168 return root;
169 }
170
144 void NotificationView::CreateOrUpdateViews(const Notification& notification) { 171 void NotificationView::CreateOrUpdateViews(const Notification& notification) {
145 CreateOrUpdateTitleView(notification); 172 CreateOrUpdateTitleView(notification);
146 CreateOrUpdateMessageView(notification); 173 CreateOrUpdateMessageView(notification);
147 CreateOrUpdateProgressBarView(notification); 174 CreateOrUpdateProgressBarView(notification);
148 CreateOrUpdateListItemViews(notification); 175 CreateOrUpdateListItemViews(notification);
149 CreateOrUpdateIconView(notification); 176 CreateOrUpdateIconView(notification);
150 CreateOrUpdateSmallIconView(notification); 177 CreateOrUpdateSmallIconView(notification);
151 CreateOrUpdateImageView(notification); 178 CreateOrUpdateImageView(notification);
152 CreateOrUpdateContextMessageView(notification); 179 CreateOrUpdateContextMessageView(notification);
180 CreateOrUpdateSettingsButtonView(notification);
153 CreateOrUpdateActionButtonViews(notification); 181 CreateOrUpdateActionButtonViews(notification);
154 } 182 }
155 183
156 NotificationView::NotificationView(MessageCenterController* controller, 184 NotificationView::NotificationView(MessageCenterController* controller,
157 const Notification& notification) 185 const Notification& notification)
158 : MessageView(controller, notification), 186 : MessageView(controller, notification),
159 clickable_(notification.clickable()) { 187 clickable_(notification.clickable()) {
160 // Create the top_view_, which collects into a vertical box all content 188 // Create the top_view_, which collects into a vertical box all content
161 // at the top of the notification (to the right of the icon) except for the 189 // at the top of the notification (to the right of the icon) except for the
162 // close button. 190 // close button.
163 top_view_ = new views::View(); 191 top_view_ = new views::View();
164 top_view_->SetLayoutManager( 192 top_view_->SetLayoutManager(
165 new views::BoxLayout(views::BoxLayout::kVertical)); 193 new views::BoxLayout(views::BoxLayout::kVertical));
166 top_view_->SetBorder( 194 top_view_->SetBorder(
167 MakeEmptyBorder(kTextTopPadding - 8, 0, kTextBottomPadding - 5, 0)); 195 MakeEmptyBorder(kTextTopPadding - 8, 0, kTextBottomPadding - 5, 0));
168 AddChildView(top_view_); 196 AddChildView(top_view_);
169 // Create the bottom_view_, which collects into a vertical box all content 197 // Create the bottom_view_, which collects into a vertical box all content
170 // below the notification icon. 198 // below the notification icon.
171 bottom_view_ = new views::View(); 199 bottom_view_ = new views::View();
172 bottom_view_->SetLayoutManager( 200 bottom_view_->SetLayoutManager(
173 new views::BoxLayout(views::BoxLayout::kVertical)); 201 new views::BoxLayout(views::BoxLayout::kVertical));
174 AddChildView(bottom_view_); 202 AddChildView(bottom_view_);
175 203
176 control_buttons_view_ = new NotificationControlButtonsView(this);
177 AddChildView(control_buttons_view_);
178
179 views::ImageView* small_image_view = new views::ImageView(); 204 views::ImageView* small_image_view = new views::ImageView();
180 small_image_view->SetImageSize(gfx::Size(kSmallImageSize, kSmallImageSize)); 205 small_image_view->SetImageSize(gfx::Size(kSmallImageSize, kSmallImageSize));
181 small_image_view->set_owned_by_client(); 206 small_image_view->set_owned_by_client();
182 small_image_view_.reset(small_image_view); 207 small_image_view_.reset(small_image_view);
183 208
184 CreateOrUpdateViews(notification); 209 CreateOrUpdateViews(notification);
185 210
186 // Put together the different content and control views. Layering those allows 211 // Put together the different content and control views. Layering those allows
187 // for proper layout logic and it also allows the control buttons and small 212 // for proper layout logic and it also allows the close button and small
188 // image to overlap the content as needed to provide large enough click and 213 // image to overlap the content as needed to provide large enough click and
189 // touch areas (<http://crbug.com/168822> and <http://crbug.com/168856>). 214 // touch areas (<http://crbug.com/168822> and <http://crbug.com/168856>).
190 AddChildView(small_image_view_.get()); 215 AddChildView(small_image_view_.get());
191 UpdateControlButtonsVisibilityWithNotification(notification); 216 CreateOrUpdateCloseButtonView(notification);
192 217
193 SetEventTargeter( 218 SetEventTargeter(
194 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); 219 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
195 set_notify_enter_exit_on_child(true); 220 set_notify_enter_exit_on_child(true);
196 } 221 }
197 222
198 NotificationView::~NotificationView() { 223 NotificationView::~NotificationView() {
199 } 224 }
200 225
201 gfx::Size NotificationView::CalculatePreferredSize() const { 226 gfx::Size NotificationView::CalculatePreferredSize() const {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 message_view_->SetLineLimit(GetMessageLineLimit(title_lines, width())); 284 message_view_->SetLineLimit(GetMessageLineLimit(title_lines, width()));
260 285
261 // Top views. 286 // Top views.
262 int top_height = top_view_->GetHeightForWidth(content_width); 287 int top_height = top_view_->GetHeightForWidth(content_width);
263 top_view_->SetBounds(insets.left(), insets.top(), content_width, top_height); 288 top_view_->SetBounds(insets.left(), insets.top(), content_width, top_height);
264 289
265 // Icon. 290 // Icon.
266 icon_view_->SetBounds(insets.left(), insets.top(), kNotificationIconSize, 291 icon_view_->SetBounds(insets.left(), insets.top(), kNotificationIconSize,
267 kNotificationIconSize); 292 kNotificationIconSize);
268 293
269 // Control buttons (close and settings buttons). 294 // Settings & Bottom views.
270 gfx::Rect control_buttons_bounds(content_bounds); 295 int bottom_y = insets.top() + std::max(top_height, kNotificationIconSize);
271 int buttons_width = control_buttons_view_->GetPreferredSize().width(); 296 int bottom_height = bottom_view_->GetHeightForWidth(content_width);
272 int buttons_height = control_buttons_view_->GetPreferredSize().height(); 297
273 control_buttons_bounds.set_x(control_buttons_bounds.right() - buttons_width - 298 if (settings_button_view_) {
274 message_center::kControlButtonPadding); 299 const gfx::Size settings_size(settings_button_view_->GetPreferredSize());
275 control_buttons_bounds.set_y(control_buttons_bounds.y() + 300 int marginFromRight = settings_size.width() + kControlButtonPadding;
276 message_center::kControlButtonPadding); 301 if (close_button_)
277 control_buttons_bounds.set_width(buttons_width); 302 marginFromRight += close_button_->GetPreferredSize().width();
278 control_buttons_bounds.set_height(buttons_height); 303 gfx::Rect settings_rect(insets.left() + content_width - marginFromRight,
279 control_buttons_view_->SetBoundsRect(control_buttons_bounds); 304 GetContentsBounds().y() + kControlButtonPadding,
305 settings_size.width(), settings_size.height());
306 settings_button_view_->SetBoundsRect(settings_rect);
307 }
308
309 // Close button.
310 if (close_button_) {
311 gfx::Rect content_bounds = GetContentsBounds();
312 gfx::Size close_size(close_button_->GetPreferredSize());
313 gfx::Rect close_rect(
314 content_bounds.right() - close_size.width() - kControlButtonPadding,
315 content_bounds.y() + kControlButtonPadding, close_size.width(),
316 close_size.height());
317 close_button_->SetBoundsRect(close_rect);
318 }
280 319
281 // Small icon. 320 // Small icon.
282 gfx::Size small_image_size(small_image_view_->GetPreferredSize()); 321 gfx::Size small_image_size(small_image_view_->GetPreferredSize());
283 gfx::Rect small_image_rect(small_image_size); 322 gfx::Rect small_image_rect(small_image_size);
284 small_image_rect.set_origin(gfx::Point( 323 small_image_rect.set_origin(gfx::Point(
285 content_bounds.right() - small_image_size.width() - kSmallImagePadding, 324 content_bounds.right() - small_image_size.width() - kSmallImagePadding,
286 content_bounds.bottom() - small_image_size.height() - 325 content_bounds.bottom() - small_image_size.height() -
287 kSmallImagePadding)); 326 kSmallImagePadding));
288 small_image_view_->SetBoundsRect(small_image_rect); 327 small_image_view_->SetBoundsRect(small_image_rect);
289 328
290 // Bottom views.
291 int bottom_y = insets.top() + std::max(top_height, kNotificationIconSize);
292 int bottom_height = bottom_view_->GetHeightForWidth(content_width);
293 bottom_view_->SetBounds(insets.left(), bottom_y, 329 bottom_view_->SetBounds(insets.left(), bottom_y,
294 content_width, bottom_height); 330 content_width, bottom_height);
295 } 331 }
296 332
297 void NotificationView::OnFocus() { 333 void NotificationView::OnFocus() {
298 MessageView::OnFocus(); 334 MessageView::OnFocus();
299 ScrollRectToVisible(GetLocalBounds()); 335 ScrollRectToVisible(GetLocalBounds());
300 } 336 }
301 337
302 void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) { 338 void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) {
(...skipping 22 matching lines...) Expand all
325 void NotificationView::OnMouseExited(const ui::MouseEvent& event) { 361 void NotificationView::OnMouseExited(const ui::MouseEvent& event) {
326 MessageView::OnMouseExited(event); 362 MessageView::OnMouseExited(event);
327 UpdateControlButtonsVisibility(); 363 UpdateControlButtonsVisibility();
328 } 364 }
329 365
330 void NotificationView::UpdateWithNotification( 366 void NotificationView::UpdateWithNotification(
331 const Notification& notification) { 367 const Notification& notification) {
332 MessageView::UpdateWithNotification(notification); 368 MessageView::UpdateWithNotification(notification);
333 369
334 CreateOrUpdateViews(notification); 370 CreateOrUpdateViews(notification);
335 UpdateControlButtonsVisibilityWithNotification(notification); 371 CreateOrUpdateCloseButtonView(notification);
336 Layout(); 372 Layout();
337 SchedulePaint(); 373 SchedulePaint();
338 } 374 }
339 375
340 void NotificationView::ButtonPressed(views::Button* sender, 376 void NotificationView::ButtonPressed(views::Button* sender,
341 const ui::Event& event) { 377 const ui::Event& event) {
342 // Certain operations can cause |this| to be destructed, so copy the members 378 // Certain operations can cause |this| to be destructed, so copy the members
343 // we send to other parts of the code. 379 // we send to other parts of the code.
344 // TODO(dewittj): Remove this hack. 380 // TODO(dewittj): Remove this hack.
345 std::string id(notification_id()); 381 std::string id(notification_id());
346 382
383 if (close_button_ && sender == close_button_.get()) {
384 // Warning: This causes the NotificationView itself to be deleted, so don't
385 // do anything afterwards.
386 OnCloseButtonPressed();
387 return;
388 }
389
390 if (sender == settings_button_view_) {
391 OnSettingsButtonPressed();
392 return;
393 }
394
347 // See if the button pressed was an action button. 395 // See if the button pressed was an action button.
348 for (size_t i = 0; i < action_buttons_.size(); ++i) { 396 for (size_t i = 0; i < action_buttons_.size(); ++i) {
349 if (sender == action_buttons_[i]) { 397 if (sender == action_buttons_[i]) {
350 controller()->ClickOnNotificationButton(id, i); 398 controller()->ClickOnNotificationButton(id, i);
351 return; 399 return;
352 } 400 }
353 } 401 }
354
355 NOTREACHED();
356 } 402 }
357 403
358 bool NotificationView::IsCloseButtonFocused() const { 404 bool NotificationView::IsCloseButtonFocused() const {
359 return control_buttons_view_->IsCloseButtonFocused(); 405 if (!close_button_)
406 return false;
407
408 const views::FocusManager* focus_manager = GetFocusManager();
409 return focus_manager &&
410 focus_manager->GetFocusedView() == close_button_.get();
360 } 411 }
361 412
362 void NotificationView::RequestFocusOnCloseButton() { 413 void NotificationView::RequestFocusOnCloseButton() {
363 control_buttons_view_->RequestFocusOnCloseButton(); 414 if (close_button_)
415 close_button_->RequestFocus();
364 } 416 }
365 417
366 void NotificationView::CreateOrUpdateTitleView( 418 void NotificationView::CreateOrUpdateTitleView(
367 const Notification& notification) { 419 const Notification& notification) {
368 if (notification.title().empty()) { 420 if (notification.title().empty()) {
369 // Deletion will also remove |title_view_| from its parent. 421 // Deletion will also remove |title_view_| from its parent.
370 delete title_view_; 422 delete title_view_;
371 title_view_ = nullptr; 423 title_view_ = nullptr;
372 return; 424 return;
373 } 425 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 context_message_view_->SetLineHeight(kMessageLineHeight); 516 context_message_view_->SetLineHeight(kMessageLineHeight);
465 context_message_view_->SetColors(message_center::kDimTextColor, 517 context_message_view_->SetColors(message_center::kDimTextColor,
466 kContextTextBackgroundColor); 518 kContextTextBackgroundColor);
467 context_message_view_->SetBorder(MakeTextBorder(padding, 4, 0)); 519 context_message_view_->SetBorder(MakeTextBorder(padding, 4, 0));
468 top_view_->AddChildView(context_message_view_); 520 top_view_->AddChildView(context_message_view_);
469 } else { 521 } else {
470 context_message_view_->SetText(message); 522 context_message_view_->SetText(message);
471 } 523 }
472 } 524 }
473 525
526 void NotificationView::CreateOrUpdateSettingsButtonView(
527 const Notification& notification) {
528 delete settings_button_view_;
529 settings_button_view_ = nullptr;
530
531 if (!settings_button_view_ && notification.delegate() &&
532 notification.delegate()->ShouldDisplaySettingsButton()) {
533 PaddedButton* settings = new PaddedButton(this);
534 settings->SetImage(views::Button::STATE_NORMAL, GetSettingsIcon());
535 settings->SetAccessibleName(l10n_util::GetStringUTF16(
536 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME));
537 settings->SetTooltipText(l10n_util::GetStringUTF16(
538 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME));
539 settings_button_view_ = settings;
540 AddChildView(settings_button_view_);
541 }
542 UpdateControlButtonsVisibility();
543 }
544
474 void NotificationView::CreateOrUpdateProgressBarView( 545 void NotificationView::CreateOrUpdateProgressBarView(
475 const Notification& notification) { 546 const Notification& notification) {
476 if (notification.type() != NOTIFICATION_TYPE_PROGRESS) { 547 if (notification.type() != NOTIFICATION_TYPE_PROGRESS) {
477 // Deletion will also remove |progress_bar_view_| from its parent. 548 // Deletion will also remove |progress_bar_view_| from its parent.
478 delete progress_bar_view_; 549 delete progress_bar_view_;
479 progress_bar_view_ = nullptr; 550 progress_bar_view_ = nullptr;
480 return; 551 return;
481 } 552 }
482 553
483 DCHECK(top_view_); 554 DCHECK(top_view_);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if (new_buttons) { 686 if (new_buttons) {
616 Layout(); 687 Layout();
617 views::Widget* widget = GetWidget(); 688 views::Widget* widget = GetWidget();
618 if (widget != NULL) { 689 if (widget != NULL) {
619 widget->SetSize(widget->GetContentsView()->GetPreferredSize()); 690 widget->SetSize(widget->GetContentsView()->GetPreferredSize());
620 GetWidget()->SynthesizeMouseMoveEvent(); 691 GetWidget()->SynthesizeMouseMoveEvent();
621 } 692 }
622 } 693 }
623 } 694 }
624 695
625 void NotificationView::UpdateControlButtonsVisibilityWithNotification( 696 void NotificationView::CreateOrUpdateCloseButtonView(
626 const Notification& notification) { 697 const Notification& notification) {
627 control_buttons_view_->ShowSettingsButton( 698 if (!notification.pinned() && !close_button_) {
628 notification.delegate() && 699 close_button_ = base::MakeUnique<PaddedButton>(this);
629 notification.delegate()->ShouldDisplaySettingsButton()); 700 close_button_->SetImage(views::Button::STATE_NORMAL, GetCloseIcon());
630 control_buttons_view_->ShowCloseButton(!notification.pinned()); 701 close_button_->SetAccessibleName(l10n_util::GetStringUTF16(
631 UpdateControlButtonsVisibility(); 702 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME));
703 close_button_->SetTooltipText(l10n_util::GetStringUTF16(
704 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_TOOLTIP));
705 close_button_->set_owned_by_client();
706 AddChildView(close_button_.get());
707 UpdateControlButtonsVisibility();
708 } else if (notification.pinned() && close_button_) {
709 close_button_.reset();
710 }
632 } 711 }
633 712
634 void NotificationView::UpdateControlButtonsVisibility() { 713 void NotificationView::UpdateControlButtonsVisibility() {
635 #if defined(OS_CHROMEOS) 714 #if defined(OS_CHROMEOS)
636 // On Chrome OS, the settings button and the close button are shown when: 715 // On Chrome OS, the settings button and the close button are shown only when
637 // (1) the mouse is hovering on the notification. 716 // the mouse is hovering on the notification.
638 // (2) the focus is on the control buttons.
639 const bool target_visibility = 717 const bool target_visibility =
640 IsMouseHovered() || HasFocus() || 718 IsMouseHovered() || HasFocus() ||
641 control_buttons_view_->IsCloseButtonFocused() || 719 (close_button_ &&
642 control_buttons_view_->IsSettingsButtonFocused(); 720 (close_button_->HasFocus() || close_button_->IsMouseHovered())) ||
721 (settings_button_view_ && (settings_button_view_->HasFocus() ||
722 settings_button_view_->IsMouseHovered()));
643 #else 723 #else
644 // On non Chrome OS, the settings button and the close button are always 724 // On non Chrome OS, the settings button and the close button are always
645 // shown. 725 // shown.
646 const bool target_visibility = true; 726 const bool target_visibility = true;
647 #endif 727 #endif
648 728
649 control_buttons_view_->SetVisible(target_visibility); 729 if (close_button_) {
730 if (target_visibility != close_button_->visible())
731 close_button_->SetVisible(target_visibility);
732 }
733
734 if (settings_button_view_) {
735 if (target_visibility != settings_button_view_->visible())
736 settings_button_view_->SetVisible(target_visibility);
737 }
650 } 738 }
651 739
652 int NotificationView::GetMessageLineLimit(int title_lines, int width) const { 740 int NotificationView::GetMessageLineLimit(int title_lines, int width) const {
653 // Image notifications require that the image must be kept flush against 741 // Image notifications require that the image must be kept flush against
654 // their icons, but we can allow more text if no image. 742 // their icons, but we can allow more text if no image.
655 int effective_title_lines = std::max(0, title_lines - 1); 743 int effective_title_lines = std::max(0, title_lines - 1);
656 int line_reduction_from_title = (image_view_ ? 1 : 2) * effective_title_lines; 744 int line_reduction_from_title = (image_view_ ? 1 : 2) * effective_title_lines;
657 if (!image_view_) { 745 if (!image_view_) {
658 // Title lines are counted as twice as big as message lines for the purpose 746 // Title lines are counted as twice as big as message lines for the purpose
659 // of this calculation. 747 // of this calculation.
(...skipping 24 matching lines...) Expand all
684 772
685 return message_line_limit; 773 return message_line_limit;
686 } 774 }
687 775
688 int NotificationView::GetMessageHeight(int width, int limit) const { 776 int NotificationView::GetMessageHeight(int width, int limit) const {
689 return message_view_ ? 777 return message_view_ ?
690 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 778 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
691 } 779 }
692 780
693 } // namespace message_center 781 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view.h ('k') | ui/message_center/views/notification_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698