| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 full_system_tray_menu_ = items.size() > 1; | 493 full_system_tray_menu_ = items.size() > 1; |
| 494 // The menu width is fixed, and it is a per language setting. | 494 // The menu width is fixed, and it is a per language setting. |
| 495 int menu_width = std::max(kMinimumSystemTrayMenuWidth, | 495 int menu_width = std::max(kMinimumSystemTrayMenuWidth, |
| 496 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); | 496 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); |
| 497 | 497 |
| 498 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 498 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
| 499 GetAnchorAlignment(), | 499 GetAnchorAlignment(), |
| 500 menu_width, | 500 menu_width, |
| 501 kTrayPopupMaxWidth); | 501 kTrayPopupMaxWidth); |
| 502 init_params.can_activate = can_activate; | 502 init_params.can_activate = can_activate; |
| 503 // Mus cannot use EventHandlers to close the tray, so it uses capture. |
| 504 init_params.close_via_capture = Shell::GetInstance()->in_mus(); |
| 503 init_params.first_item_has_no_margin = true; | 505 init_params.first_item_has_no_margin = true; |
| 504 if (detailed) { | 506 if (detailed) { |
| 505 // This is the case where a volume control or brightness control bubble | 507 // This is the case where a volume control or brightness control bubble |
| 506 // is created. | 508 // is created. |
| 507 init_params.max_height = default_bubble_height_; | 509 init_params.max_height = default_bubble_height_; |
| 508 init_params.arrow_color = kBackgroundColor; | 510 init_params.arrow_color = kBackgroundColor; |
| 509 } else { | 511 } else { |
| 510 init_params.arrow_color = kHeaderBackgroundColor; | 512 init_params.arrow_color = kHeaderBackgroundColor; |
| 511 } | 513 } |
| 512 init_params.arrow_offset = arrow_offset; | 514 init_params.arrow_offset = arrow_offset; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 anchor = system_bubble_->bubble_view(); | 567 anchor = system_bubble_->bubble_view(); |
| 566 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; | 568 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; |
| 567 } else { | 569 } else { |
| 568 anchor = tray_container(); | 570 anchor = tray_container(); |
| 569 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 571 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
| 570 } | 572 } |
| 571 TrayBubbleView::InitParams init_params(anchor_type, | 573 TrayBubbleView::InitParams init_params(anchor_type, |
| 572 GetAnchorAlignment(), | 574 GetAnchorAlignment(), |
| 573 kTrayPopupMinWidth, | 575 kTrayPopupMinWidth, |
| 574 kTrayPopupMaxWidth); | 576 kTrayPopupMaxWidth); |
| 577 // Mus cannot use EventHandlers to close the tray, so it uses capture. |
| 578 init_params.close_via_capture = Shell::GetInstance()->in_mus(); |
| 575 init_params.first_item_has_no_margin = true; | 579 init_params.first_item_has_no_margin = true; |
| 576 init_params.arrow_color = kBackgroundColor; | 580 init_params.arrow_color = kBackgroundColor; |
| 577 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 581 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
| 578 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble)); | 582 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble)); |
| 579 notification_bubble_->InitView(this, anchor, &init_params, false); | 583 notification_bubble_->InitView(this, anchor, &init_params, false); |
| 580 | 584 |
| 581 if (notification_bubble->bubble_view()->child_count() == 0) { | 585 if (notification_bubble->bubble_view()->child_count() == 0) { |
| 582 // It is possible that none of the items generated actual notifications. | 586 // It is possible that none of the items generated actual notifications. |
| 583 DestroyNotificationBubble(); | 587 DestroyNotificationBubble(); |
| 584 return; | 588 return; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 system_bubble_.reset(); | 736 system_bubble_.reset(); |
| 733 // When closing a system bubble with the alternate shelf layout, we need to | 737 // When closing a system bubble with the alternate shelf layout, we need to |
| 734 // turn off the active tinting of the shelf. | 738 // turn off the active tinting of the shelf. |
| 735 if (full_system_tray_menu_) { | 739 if (full_system_tray_menu_) { |
| 736 SetDrawBackgroundAsActive(false); | 740 SetDrawBackgroundAsActive(false); |
| 737 full_system_tray_menu_ = false; | 741 full_system_tray_menu_ = false; |
| 738 } | 742 } |
| 739 } | 743 } |
| 740 | 744 |
| 741 } // namespace ash | 745 } // namespace ash |
| OLD | NEW |