| 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 if (ash::switches::UseAlternateShelfLayout()) { | 97 // The system bubble should not have an arrow. |
| 98 // The system bubble should not have an arrow. | 98 bubble_->bubble_view()->SetArrowPaintType( |
| 99 bubble_->bubble_view()->SetArrowPaintType( | 99 views::BubbleBorder::PAINT_NONE); |
| 100 views::BubbleBorder::PAINT_NONE); | |
| 101 } | |
| 102 is_persistent_ = is_persistent; | 100 is_persistent_ = is_persistent; |
| 103 | 101 |
| 104 // If ChromeVox is enabled, focus the default item if no item is focused. | 102 // If ChromeVox is enabled, focus the default item if no item is focused. |
| 105 if (Shell::GetInstance()->accessibility_delegate()-> | 103 if (Shell::GetInstance()->accessibility_delegate()-> |
| 106 IsSpokenFeedbackEnabled()) { | 104 IsSpokenFeedbackEnabled()) { |
| 107 bubble_->FocusDefaultIfNeeded(); | 105 bubble_->FocusDefaultIfNeeded(); |
| 108 } | 106 } |
| 109 } | 107 } |
| 110 | 108 |
| 111 // Convenience accessors: | 109 // Convenience accessors: |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 full_system_tray_menu_ = items.size() > 1; | 467 full_system_tray_menu_ = items.size() > 1; |
| 470 // The menu width is fixed, and it is a per language setting. | 468 // The menu width is fixed, and it is a per language setting. |
| 471 int menu_width = std::max(kMinimumSystemTrayMenuWidth, | 469 int menu_width = std::max(kMinimumSystemTrayMenuWidth, |
| 472 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); | 470 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); |
| 473 | 471 |
| 474 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 472 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
| 475 GetAnchorAlignment(), | 473 GetAnchorAlignment(), |
| 476 menu_width, | 474 menu_width, |
| 477 kTrayPopupMaxWidth); | 475 kTrayPopupMaxWidth); |
| 478 init_params.can_activate = can_activate; | 476 init_params.can_activate = can_activate; |
| 479 init_params.first_item_has_no_margin = | 477 init_params.first_item_has_no_margin = true; |
| 480 ash::switches::UseAlternateShelfLayout(); | |
| 481 if (detailed) { | 478 if (detailed) { |
| 482 // This is the case where a volume control or brightness control bubble | 479 // This is the case where a volume control or brightness control bubble |
| 483 // is created. | 480 // is created. |
| 484 init_params.max_height = default_bubble_height_; | 481 init_params.max_height = default_bubble_height_; |
| 485 init_params.arrow_color = kBackgroundColor; | 482 init_params.arrow_color = kBackgroundColor; |
| 486 } else { | 483 } else { |
| 487 init_params.arrow_color = kHeaderBackgroundColor; | 484 init_params.arrow_color = kHeaderBackgroundColor; |
| 488 } | 485 } |
| 489 init_params.arrow_offset = arrow_offset; | 486 init_params.arrow_offset = arrow_offset; |
| 490 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) | 487 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 anchor = system_bubble_->bubble_view(); | 538 anchor = system_bubble_->bubble_view(); |
| 542 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; | 539 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; |
| 543 } else { | 540 } else { |
| 544 anchor = tray_container(); | 541 anchor = tray_container(); |
| 545 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 542 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
| 546 } | 543 } |
| 547 TrayBubbleView::InitParams init_params(anchor_type, | 544 TrayBubbleView::InitParams init_params(anchor_type, |
| 548 GetAnchorAlignment(), | 545 GetAnchorAlignment(), |
| 549 kTrayPopupMinWidth, | 546 kTrayPopupMinWidth, |
| 550 kTrayPopupMaxWidth); | 547 kTrayPopupMaxWidth); |
| 551 init_params.first_item_has_no_margin = | 548 init_params.first_item_has_no_margin = true; |
| 552 ash::switches::UseAlternateShelfLayout(); | |
| 553 init_params.arrow_color = kBackgroundColor; | 549 init_params.arrow_color = kBackgroundColor; |
| 554 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 550 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
| 555 notification_bubble_.reset( | 551 notification_bubble_.reset( |
| 556 new internal::SystemBubbleWrapper(notification_bubble)); | 552 new internal::SystemBubbleWrapper(notification_bubble)); |
| 557 notification_bubble_->InitView(this, anchor, &init_params, false); | 553 notification_bubble_->InitView(this, anchor, &init_params, false); |
| 558 | 554 |
| 559 if (notification_bubble->bubble_view()->child_count() == 0) { | 555 if (notification_bubble->bubble_view()->child_count() == 0) { |
| 560 // It is possible that none of the items generated actual notifications. | 556 // It is possible that none of the items generated actual notifications. |
| 561 DestroyNotificationBubble(); | 557 DestroyNotificationBubble(); |
| 562 return; | 558 return; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 system_bubble_.reset(); | 706 system_bubble_.reset(); |
| 711 // When closing a system bubble with the alternate shelf layout, we need to | 707 // When closing a system bubble with the alternate shelf layout, we need to |
| 712 // turn off the active tinting of the shelf. | 708 // turn off the active tinting of the shelf. |
| 713 if (full_system_tray_menu_) { | 709 if (full_system_tray_menu_) { |
| 714 SetDrawBackgroundAsActive(false); | 710 SetDrawBackgroundAsActive(false); |
| 715 full_system_tray_menu_ = false; | 711 full_system_tray_menu_ = false; |
| 716 } | 712 } |
| 717 } | 713 } |
| 718 | 714 |
| 719 } // namespace ash | 715 } // namespace ash |
| OLD | NEW |