| 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 "ash/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/metrics/user_metrics_recorder.h" | 8 #include "ash/metrics/user_metrics_recorder.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void InitView(TrayBackgroundView* tray, | 87 void InitView(TrayBackgroundView* tray, |
| 88 views::View* anchor, | 88 views::View* anchor, |
| 89 TrayBubbleView::InitParams* init_params, | 89 TrayBubbleView::InitParams* init_params, |
| 90 bool is_persistent) { | 90 bool is_persistent) { |
| 91 DCHECK(anchor); | 91 DCHECK(anchor); |
| 92 user::LoginStatus login_status = | 92 user::LoginStatus login_status = |
| 93 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); | 93 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); |
| 94 bubble_->InitView(anchor, login_status, init_params); | 94 bubble_->InitView(anchor, login_status, init_params); |
| 95 bubble_wrapper_.reset( | 95 bubble_wrapper_.reset( |
| 96 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); | 96 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); |
| 97 // The system bubble should not have an arrow. | 97 if (ash::switches::UseAlternateShelfLayout()) { |
| 98 bubble_->bubble_view()->SetArrowPaintType( | 98 // The system bubble should not have an arrow. |
| 99 views::BubbleBorder::PAINT_NONE); | 99 bubble_->bubble_view()->SetArrowPaintType( |
| 100 views::BubbleBorder::PAINT_NONE); |
| 101 } |
| 100 is_persistent_ = is_persistent; | 102 is_persistent_ = is_persistent; |
| 101 | 103 |
| 102 // If ChromeVox is enabled, focus the default item if no item is focused. | 104 // If ChromeVox is enabled, focus the default item if no item is focused. |
| 103 if (Shell::GetInstance()->accessibility_delegate()-> | 105 if (Shell::GetInstance()->accessibility_delegate()-> |
| 104 IsSpokenFeedbackEnabled()) { | 106 IsSpokenFeedbackEnabled()) { |
| 105 bubble_->FocusDefaultIfNeeded(); | 107 bubble_->FocusDefaultIfNeeded(); |
| 106 } | 108 } |
| 107 } | 109 } |
| 108 | 110 |
| 109 // Convenience accessors: | 111 // Convenience accessors: |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 full_system_tray_menu_ = items.size() > 1; | 475 full_system_tray_menu_ = items.size() > 1; |
| 474 // The menu width is fixed, and it is a per language setting. | 476 // The menu width is fixed, and it is a per language setting. |
| 475 int menu_width = std::max(kMinimumSystemTrayMenuWidth, | 477 int menu_width = std::max(kMinimumSystemTrayMenuWidth, |
| 476 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); | 478 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); |
| 477 | 479 |
| 478 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 480 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
| 479 GetAnchorAlignment(), | 481 GetAnchorAlignment(), |
| 480 menu_width, | 482 menu_width, |
| 481 kTrayPopupMaxWidth); | 483 kTrayPopupMaxWidth); |
| 482 init_params.can_activate = can_activate; | 484 init_params.can_activate = can_activate; |
| 483 init_params.first_item_has_no_margin = true; | 485 init_params.first_item_has_no_margin = |
| 486 ash::switches::UseAlternateShelfLayout(); |
| 484 if (detailed) { | 487 if (detailed) { |
| 485 // This is the case where a volume control or brightness control bubble | 488 // This is the case where a volume control or brightness control bubble |
| 486 // is created. | 489 // is created. |
| 487 init_params.max_height = default_bubble_height_; | 490 init_params.max_height = default_bubble_height_; |
| 488 init_params.arrow_color = kBackgroundColor; | 491 init_params.arrow_color = kBackgroundColor; |
| 489 } else { | 492 } else { |
| 490 init_params.arrow_color = kHeaderBackgroundColor; | 493 init_params.arrow_color = kHeaderBackgroundColor; |
| 491 } | 494 } |
| 492 init_params.arrow_offset = arrow_offset; | 495 init_params.arrow_offset = arrow_offset; |
| 493 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) | 496 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 anchor = system_bubble_->bubble_view(); | 547 anchor = system_bubble_->bubble_view(); |
| 545 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; | 548 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; |
| 546 } else { | 549 } else { |
| 547 anchor = tray_container(); | 550 anchor = tray_container(); |
| 548 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 551 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
| 549 } | 552 } |
| 550 TrayBubbleView::InitParams init_params(anchor_type, | 553 TrayBubbleView::InitParams init_params(anchor_type, |
| 551 GetAnchorAlignment(), | 554 GetAnchorAlignment(), |
| 552 kTrayPopupMinWidth, | 555 kTrayPopupMinWidth, |
| 553 kTrayPopupMaxWidth); | 556 kTrayPopupMaxWidth); |
| 554 init_params.first_item_has_no_margin = true; | 557 init_params.first_item_has_no_margin = |
| 558 ash::switches::UseAlternateShelfLayout(); |
| 555 init_params.arrow_color = kBackgroundColor; | 559 init_params.arrow_color = kBackgroundColor; |
| 556 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 560 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
| 557 notification_bubble_.reset( | 561 notification_bubble_.reset( |
| 558 new internal::SystemBubbleWrapper(notification_bubble)); | 562 new internal::SystemBubbleWrapper(notification_bubble)); |
| 559 notification_bubble_->InitView(this, anchor, &init_params, false); | 563 notification_bubble_->InitView(this, anchor, &init_params, false); |
| 560 | 564 |
| 561 if (notification_bubble->bubble_view()->child_count() == 0) { | 565 if (notification_bubble->bubble_view()->child_count() == 0) { |
| 562 // It is possible that none of the items generated actual notifications. | 566 // It is possible that none of the items generated actual notifications. |
| 563 DestroyNotificationBubble(); | 567 DestroyNotificationBubble(); |
| 564 return; | 568 return; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 system_bubble_.reset(); | 721 system_bubble_.reset(); |
| 718 // When closing a system bubble with the alternate shelf layout, we need to | 722 // When closing a system bubble with the alternate shelf layout, we need to |
| 719 // turn off the active tinting of the shelf. | 723 // turn off the active tinting of the shelf. |
| 720 if (full_system_tray_menu_) { | 724 if (full_system_tray_menu_) { |
| 721 SetDrawBackgroundAsActive(false); | 725 SetDrawBackgroundAsActive(false); |
| 722 full_system_tray_menu_ = false; | 726 full_system_tray_menu_ = false; |
| 723 } | 727 } |
| 724 } | 728 } |
| 725 | 729 |
| 726 } // namespace ash | 730 } // namespace ash |
| OLD | NEW |