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

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

Issue 149433005: Adds a small icon to notifications, and connects it to synced notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 notification_view->CreateShadowBorder(); 298 notification_view->CreateShadowBorder();
299 return notification_view; 299 return notification_view;
300 } 300 }
301 301
302 NotificationView::NotificationView(MessageCenterController* controller, 302 NotificationView::NotificationView(MessageCenterController* controller,
303 const Notification& notification, 303 const Notification& notification,
304 bool expanded) 304 bool expanded)
305 : MessageView(this, 305 : MessageView(this,
306 notification.id(), 306 notification.id(),
307 notification.notifier_id(), 307 notification.notifier_id(),
308 notification.small_image().AsImageSkia(),
308 notification.display_source()), 309 notification.display_source()),
309 controller_(controller), 310 controller_(controller),
310 clickable_(notification.clickable()), 311 clickable_(notification.clickable()),
311 is_expanded_(expanded) { 312 is_expanded_(expanded) {
312 std::vector<base::string16> accessible_lines; 313 std::vector<base::string16> accessible_lines;
313 // Create the top_view_, which collects into a vertical box all content 314 // Create the top_view_, which collects into a vertical box all content
314 // at the top of the notification (to the right of the icon) except for the 315 // at the top of the notification (to the right of the icon) except for the
315 // close button. 316 // close button.
316 top_view_ = new views::View(); 317 top_view_ = new views::View();
317 top_view_->SetLayoutManager( 318 top_view_->SetLayoutManager(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 expand_button_->SetAccessibleName(l10n_util::GetStringUTF16( 459 expand_button_->SetAccessibleName(l10n_util::GetStringUTF16(
459 IDS_MESSAGE_CENTER_EXPAND_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); 460 IDS_MESSAGE_CENTER_EXPAND_NOTIFICATION_BUTTON_ACCESSIBLE_NAME));
460 461
461 // Put together the different content and control views. Layering those allows 462 // Put together the different content and control views. Layering those allows
462 // for proper layout logic and it also allows the close and expand buttons to 463 // for proper layout logic and it also allows the close and expand buttons to
463 // overlap the content as needed to provide large enough click and touch areas 464 // overlap the content as needed to provide large enough click and touch areas
464 // (<http://crbug.com/168822> and <http://crbug.com/168856>). 465 // (<http://crbug.com/168822> and <http://crbug.com/168856>).
465 AddChildView(top_view_); 466 AddChildView(top_view_);
466 AddChildView(icon_view_); 467 AddChildView(icon_view_);
467 AddChildView(bottom_view_); 468 AddChildView(bottom_view_);
469 AddChildView(small_image());
468 AddChildView(close_button()); 470 AddChildView(close_button());
469 AddChildView(expand_button_); 471 AddChildView(expand_button_);
470 set_accessible_name(JoinString(accessible_lines, '\n')); 472 set_accessible_name(JoinString(accessible_lines, '\n'));
471 } 473 }
472 474
473 NotificationView::~NotificationView() { 475 NotificationView::~NotificationView() {
474 } 476 }
475 477
476 gfx::Size NotificationView::GetPreferredSize() { 478 gfx::Size NotificationView::GetPreferredSize() {
477 int top_width = top_view_->GetPreferredSize().width(); 479 int top_width = top_view_->GetPreferredSize().width();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 return message_view_ ? 668 return message_view_ ?
667 message_view_->GetLinesForWidthAndLimit(width, limit) : 0; 669 message_view_->GetLinesForWidthAndLimit(width, limit) : 0;
668 } 670 }
669 671
670 int NotificationView::GetMessageHeight(int width, int limit) { 672 int NotificationView::GetMessageHeight(int width, int limit) {
671 return message_view_ ? 673 return message_view_ ?
672 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 674 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
673 } 675 }
674 676
675 } // namespace message_center 677 } // namespace message_center
OLDNEW
« chrome/browser/notifications/notification.h ('K') | « ui/message_center/views/message_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698