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

Side by Side Diff: ash/system/tray/system_tray.cc

Issue 10833041: Change web notifications to show at the top of the list, clean up layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/tray/tray_bubble_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/audio/tray_volume.h" 10 #include "ash/system/audio/tray_volume.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (arrow_offset >= 0) 495 if (arrow_offset >= 0)
496 init_params.arrow_offset = arrow_offset; 496 init_params.arrow_offset = arrow_offset;
497 notification_bubble_->InitView(init_params); 497 notification_bubble_->InitView(init_params);
498 if (hide_notifications_) 498 if (hide_notifications_)
499 notification_bubble_->SetVisible(false); 499 notification_bubble_->SetVisible(false);
500 } 500 }
501 501
502 void SystemTray::UpdateNotificationAnchor() { 502 void SystemTray::UpdateNotificationAnchor() {
503 if (!notification_bubble_.get()) 503 if (!notification_bubble_.get())
504 return; 504 return;
505 notification_bubble_->bubble_view()->UpdateAnchor(); 505 notification_bubble_->bubble_view()->UpdateBubble();
506 // Ensure that the notification buble is above the launcher/status area. 506 // Ensure that the notification buble is above the launcher/status area.
507 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); 507 notification_bubble_->bubble_view()->GetWidget()->StackAtTop();
508 } 508 }
509 509
510 void SystemTray::SetBorder() { 510 void SystemTray::SetBorder() {
511 // Change the border padding for different shelf alignment. 511 // Change the border padding for different shelf alignment.
512 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { 512 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
513 set_border(views::Border::CreateEmptyBorder(0, 0, 513 set_border(views::Border::CreateEmptyBorder(0, 0,
514 kPaddingFromBottomOfScreenBottomAlignment, 514 kPaddingFromBottomOfScreenBottomAlignment,
515 kPaddingFromRightEdgeOfScreenBottomAlignment)); 515 kPaddingFromRightEdgeOfScreenBottomAlignment));
(...skipping 10 matching lines...) Expand all
526 } 526 }
527 } 527 }
528 528
529 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { 529 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
530 if (alignment == shelf_alignment()) 530 if (alignment == shelf_alignment())
531 return; 531 return;
532 internal::TrayBackgroundView::SetShelfAlignment(alignment); 532 internal::TrayBackgroundView::SetShelfAlignment(alignment);
533 UpdateAfterShelfAlignmentChange(alignment); 533 UpdateAfterShelfAlignmentChange(alignment);
534 SetBorder(); 534 SetBorder();
535 tray_container_->UpdateLayout(alignment); 535 tray_container_->UpdateLayout(alignment);
536 // Destroy an existing bubble so that it is rebuilt correctly.
537 bubble_.reset();
538 // Rebuild any notification bubble.
539 if (notification_bubble_.get()) {
540 notification_bubble_.reset();
541 UpdateNotificationBubble();
542 }
536 } 543 }
537 544
538 bool SystemTray::PerformAction(const views::Event& event) { 545 bool SystemTray::PerformAction(const views::Event& event) {
539 // If we're already showing the default view, hide it; otherwise, show it 546 // If we're already showing the default view, hide it; otherwise, show it
540 // (and hide any popup that's currently shown). 547 // (and hide any popup that's currently shown).
541 if (bubble_.get() && 548 if (bubble_.get() &&
542 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { 549 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) {
543 bubble_->Close(); 550 bubble_->Close();
544 } else { 551 } else {
545 int arrow_offset = -1; 552 int arrow_offset = -1;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 588
582 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) { 589 void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) {
583 // The tray itself expands to the right and bottom edge of the screen to make 590 // The tray itself expands to the right and bottom edge of the screen to make
584 // sure clicking on the edges brings up the popup. However, the focus border 591 // sure clicking on the edges brings up the popup. However, the focus border
585 // should be only around the container. 592 // should be only around the container.
586 if (GetWidget() && GetWidget()->IsActive()) 593 if (GetWidget() && GetWidget()->IsActive())
587 DrawBorder(canvas, GetContentsBounds()); 594 DrawBorder(canvas, GetContentsBounds());
588 } 595 }
589 596
590 } // namespace ash 597 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/tray/tray_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698