| OLD | NEW |
| 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/message_center_bubble.h" | 5 #include "ui/message_center/message_center_bubble.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 #include "ui/gfx/text_constants.h" | 13 #include "ui/gfx/text_constants.h" |
| 14 #include "ui/message_center/message_center_switches.h" | 14 #include "ui/message_center/message_center_switches.h" |
| 15 #include "ui/message_center/message_view.h" | 15 #include "ui/message_center/message_view.h" |
| 16 #include "ui/message_center/message_view_factory.h" | 16 #include "ui/message_center/notification_view.h" |
| 17 #include "ui/views/background.h" | 17 #include "ui/views/background.h" |
| 18 #include "ui/views/border.h" | 18 #include "ui/views/border.h" |
| 19 #include "ui/views/controls/button/text_button.h" | 19 #include "ui/views/controls/button/text_button.h" |
| 20 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| 21 #include "ui/views/controls/scroll_view.h" | 21 #include "ui/views/controls/scroll_view.h" |
| 22 #include "ui/views/layout/box_layout.h" | 22 #include "ui/views/layout/box_layout.h" |
| 23 #include "ui/views/layout/grid_layout.h" | 23 #include "ui/views/layout/grid_layout.h" |
| 24 #include "ui/views/painter.h" | 24 #include "ui/views/painter.h" |
| 25 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 26 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 scroller_->RequestFocus(); | 380 scroller_->RequestFocus(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void Update(const NotificationList::Notifications& notifications) { | 383 void Update(const NotificationList::Notifications& notifications) { |
| 384 scroll_content_->RemoveAllChildViews(true); | 384 scroll_content_->RemoveAllChildViews(true); |
| 385 scroll_content_->set_preferred_size(gfx::Size()); | 385 scroll_content_->set_preferred_size(gfx::Size()); |
| 386 size_t num_children = 0; | 386 size_t num_children = 0; |
| 387 for (NotificationList::Notifications::const_iterator iter = | 387 for (NotificationList::Notifications::const_iterator iter = |
| 388 notifications.begin(); iter != notifications.end(); ++iter) { | 388 notifications.begin(); iter != notifications.end(); ++iter) { |
| 389 MessageView* view = | 389 MessageView* view = |
| 390 MessageViewFactory::ViewForNotification(*iter, list_delegate_); | 390 NotificationView::ViewForNotification(*iter, list_delegate_); |
| 391 view->set_scroller(scroller_); | 391 view->set_scroller(scroller_); |
| 392 view->SetUpView(); | 392 view->SetUpView(); |
| 393 if (UseNewDesign()) { | 393 if (UseNewDesign()) { |
| 394 views::View* container = new views::View(); | 394 views::View* container = new views::View(); |
| 395 container->SetLayoutManager( | 395 container->SetLayoutManager( |
| 396 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 396 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| 397 container->AddChildView(view); | 397 container->AddChildView(view); |
| 398 container->AddChildView(new MessageViewShadow()); | 398 container->AddChildView(new MessageViewShadow()); |
| 399 scroll_content_->AddChildView(container); | 399 scroll_content_->AddChildView(container); |
| 400 } else { | 400 } else { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 505 } |
| 506 | 506 |
| 507 void MessageCenterBubble::OnMouseExitedView() { | 507 void MessageCenterBubble::OnMouseExitedView() { |
| 508 } | 508 } |
| 509 | 509 |
| 510 size_t MessageCenterBubble::NumMessageViewsForTest() const { | 510 size_t MessageCenterBubble::NumMessageViewsForTest() const { |
| 511 return contents_view_->NumMessageViews(); | 511 return contents_view_->NumMessageViews(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 } // namespace message_center | 514 } // namespace message_center |
| OLD | NEW |