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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 10831159: Fix Ash status area bubble borders (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/system/status_area_widget.h" 7 #include "ash/system/status_area_widget.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "ash/system/tray/tray_bubble_view.h" 9 #include "ash/system/tray/tray_bubble_view.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 private: 476 private:
477 WebNotificationTray* tray_; 477 WebNotificationTray* tray_;
478 TrayPopupTextButton* close_all_button_; 478 TrayPopupTextButton* close_all_button_;
479 479
480 DISALLOW_COPY_AND_ASSIGN(WebNotificationButtonView); 480 DISALLOW_COPY_AND_ASSIGN(WebNotificationButtonView);
481 }; 481 };
482 482
483 class WebContentsView : public views::View { 483 class WebContentsView : public views::View {
484 public: 484 public:
485 WebContentsView() {} 485 explicit WebContentsView(WebNotificationTray* tray)
486 : tray_(tray) {
487 // TODO(stevenjb): Remove this border when TrayBubbleBorder is integrated
488 // with BubbleBorder.
489 int left = (tray->shelf_alignment() == SHELF_ALIGNMENT_LEFT) ? 0 : 1;
490 int right = (tray->shelf_alignment() == SHELF_ALIGNMENT_RIGHT) ? 0 : 1;
491 int bottom = (tray->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) ? 0 : 1;
492 set_border(views::Border::CreateSolidSidedBorder(
493 1, left, bottom, right, ash::kBorderDarkColor));
494 set_notify_enter_exit_on_child(true);
495 }
486 virtual ~WebContentsView() {} 496 virtual ~WebContentsView() {}
487 497
488 virtual void Update( 498 virtual void Update(
489 const WebNotificationList::Notifications& notifications) = 0; 499 const WebNotificationList::Notifications& notifications) = 0;
490 500
501 protected:
502 WebNotificationTray* tray_;
503
491 private: 504 private:
492 DISALLOW_COPY_AND_ASSIGN(WebContentsView); 505 DISALLOW_COPY_AND_ASSIGN(WebContentsView);
493 }; 506 };
494 507
495 class MessageCenterContentsView : public WebContentsView { 508 class MessageCenterContentsView : public WebContentsView {
496 public: 509 public:
497 explicit MessageCenterContentsView(WebNotificationTray* tray) 510 explicit MessageCenterContentsView(WebNotificationTray* tray)
498 : tray_(tray) { 511 : WebContentsView(tray) {
499 set_border(views::Border::CreateSolidSidedBorder(
500 1, 1, 1, 1, ash::kBorderDarkColor));
501
502 SetLayoutManager( 512 SetLayoutManager(
503 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 513 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
504 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 514 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
505 515
506 scroll_content_ = new views::View; 516 scroll_content_ = new views::View;
507 scroll_content_->SetLayoutManager( 517 scroll_content_->SetLayoutManager(
508 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 518 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
509 519
510 scroller_ = new internal::FixedSizedScrollView; 520 scroller_ = new internal::FixedSizedScrollView;
511 scroller_->SetContentsView(scroll_content_); 521 scroller_->SetContentsView(scroll_content_);
(...skipping 23 matching lines...) Expand all
535 int button_height = button_view_->GetPreferredSize().height(); 545 int button_height = button_view_->GetPreferredSize().height();
536 int scroll_height = std::min( 546 int scroll_height = std::min(
537 std::max(scroll_size.height(), 547 std::max(scroll_size.height(),
538 kWebNotificationBubbleMinHeight - button_height), 548 kWebNotificationBubbleMinHeight - button_height),
539 kWebNotificationBubbleMaxHeight - button_height); 549 kWebNotificationBubbleMaxHeight - button_height);
540 scroll_size.set_height(scroll_height); 550 scroll_size.set_height(scroll_height);
541 scroller_->SetFixedSize(scroll_size); 551 scroller_->SetFixedSize(scroll_size);
542 scroller_->SizeToPreferredSize(); 552 scroller_->SizeToPreferredSize();
543 } 553 }
544 554
545 WebNotificationTray* tray_;
546 internal::FixedSizedScrollView* scroller_; 555 internal::FixedSizedScrollView* scroller_;
547 views::View* scroll_content_; 556 views::View* scroll_content_;
548 internal::WebNotificationButtonView* button_view_; 557 internal::WebNotificationButtonView* button_view_;
549 558
550 DISALLOW_COPY_AND_ASSIGN(MessageCenterContentsView); 559 DISALLOW_COPY_AND_ASSIGN(MessageCenterContentsView);
551 }; 560 };
552 561
553 class WebNotificationContentsView : public WebContentsView { 562 class WebNotificationContentsView : public WebContentsView {
554 public: 563 public:
555 explicit WebNotificationContentsView(WebNotificationTray* tray) 564 explicit WebNotificationContentsView(WebNotificationTray* tray)
556 : tray_(tray) { 565 : WebContentsView(tray) {
557 set_border(views::Border::CreateSolidSidedBorder(
558 1, 1, 1, 1, ash::kBorderDarkColor));
559
560 SetLayoutManager( 566 SetLayoutManager(
561 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 567 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
562 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 568 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
563 569
564 content_ = new views::View; 570 content_ = new views::View;
565 content_->SetLayoutManager( 571 content_->SetLayoutManager(
566 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 572 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
567 AddChildView(content_); 573 AddChildView(content_);
568 } 574 }
569 575
570 void Update(const WebNotificationList::Notifications& notifications) { 576 void Update(const WebNotificationList::Notifications& notifications) {
571 content_->RemoveAllChildViews(true); 577 content_->RemoveAllChildViews(true);
572 WebNotificationList::Notifications::const_iterator iter = 578 WebNotificationList::Notifications::const_iterator iter =
573 notifications.begin(); 579 notifications.begin();
574 WebNotificationView* view = new WebNotificationView(tray_, *iter); 580 WebNotificationView* view = new WebNotificationView(tray_, *iter);
575 content_->AddChildView(view); 581 content_->AddChildView(view);
576 GetWidget()->GetRootView()->SchedulePaint(); 582 GetWidget()->GetRootView()->SchedulePaint();
577 } 583 }
578 584
579 private: 585 private:
580 WebNotificationTray* tray_;
581 views::View* content_; 586 views::View* content_;
582 587
583 DISALLOW_COPY_AND_ASSIGN(WebNotificationContentsView); 588 DISALLOW_COPY_AND_ASSIGN(WebNotificationContentsView);
584 }; 589 };
585 590
586 } // namespace internal 591 } // namespace internal
587 592
588 using internal::TrayBubbleView; 593 using internal::TrayBubbleView;
589 using internal::WebNotificationList; 594 using internal::WebNotificationList;
590 using internal::WebContentsView; 595 using internal::WebContentsView;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 936
932 void WebNotificationTray::HideBubble(Bubble* bubble) { 937 void WebNotificationTray::HideBubble(Bubble* bubble) {
933 if (bubble == message_center_bubble()) { 938 if (bubble == message_center_bubble()) {
934 HideMessageCenterBubble(); 939 HideMessageCenterBubble();
935 } else if (bubble == notification_bubble()) { 940 } else if (bubble == notification_bubble()) {
936 notification_bubble_.reset(); 941 notification_bubble_.reset();
937 } 942 }
938 } 943 }
939 944
940 } // namespace ash 945 } // namespace ash
OLDNEW
« ash/system/tray/system_tray_bubble.cc ('K') | « ash/system/tray/system_tray_bubble.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698