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/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell/panel_window.h" | 10 #include "ash/shell/panel_window.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 // Initializes the bubble view and creates |bubble_wrapper_|. | 82 // Initializes the bubble view and creates |bubble_wrapper_|. |
83 void InitView(TrayBackgroundView* tray, | 83 void InitView(TrayBackgroundView* tray, |
84 views::View* anchor, | 84 views::View* anchor, |
85 TrayBubbleView::InitParams* init_params) { | 85 TrayBubbleView::InitParams* init_params) { |
86 DCHECK(anchor); | 86 DCHECK(anchor); |
87 user::LoginStatus login_status = | 87 user::LoginStatus login_status = |
88 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); | 88 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); |
89 bubble_->InitView(anchor, login_status, init_params); | 89 bubble_->InitView(anchor, login_status, init_params); |
90 bubble_wrapper_.reset( | 90 bubble_wrapper_.reset( |
91 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); | 91 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); |
92 if (ash::switches::UseAlternateShelfLayout()) { | |
93 // The system bubble should not have an arrow. | |
94 bubble_->bubble_view()->SetArrowPaintType( | |
95 views::BubbleBorder::PAINT_NONE); | |
96 } | |
simonhong_
2013/06/15 15:21:07
This code is actually changing PAINT_NORMAL to PAI
| |
92 } | 97 } |
93 | 98 |
94 // Convenience accessors: | 99 // Convenience accessors: |
95 SystemTrayBubble* bubble() const { return bubble_.get(); } | 100 SystemTrayBubble* bubble() const { return bubble_.get(); } |
96 SystemTrayBubble::BubbleType bubble_type() const { | 101 SystemTrayBubble::BubbleType bubble_type() const { |
97 return bubble_->bubble_type(); | 102 return bubble_->bubble_type(); |
98 } | 103 } |
99 TrayBubbleView* bubble_view() const { return bubble_->bubble_view(); } | 104 TrayBubbleView* bubble_view() const { return bubble_->bubble_view(); } |
100 | 105 |
101 private: | 106 private: |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 | 508 |
504 void SystemTray::AnchorUpdated() { | 509 void SystemTray::AnchorUpdated() { |
505 if (notification_bubble_) { | 510 if (notification_bubble_) { |
506 notification_bubble_->bubble_view()->UpdateBubble(); | 511 notification_bubble_->bubble_view()->UpdateBubble(); |
507 // Ensure that the notification buble is above the launcher/status area. | 512 // Ensure that the notification buble is above the launcher/status area. |
508 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); | 513 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); |
509 UpdateBubbleViewArrow(notification_bubble_->bubble_view()); | 514 UpdateBubbleViewArrow(notification_bubble_->bubble_view()); |
510 } | 515 } |
511 if (system_bubble_) { | 516 if (system_bubble_) { |
512 system_bubble_->bubble_view()->UpdateBubble(); | 517 system_bubble_->bubble_view()->UpdateBubble(); |
513 UpdateBubbleViewArrow(system_bubble_->bubble_view()); | 518 if (!ash::switches::UseAlternateShelfLayout()) |
519 UpdateBubbleViewArrow(system_bubble_->bubble_view()); | |
514 } | 520 } |
515 } | 521 } |
516 | 522 |
517 base::string16 SystemTray::GetAccessibleNameForTray() { | 523 base::string16 SystemTray::GetAccessibleNameForTray() { |
518 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); | 524 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); |
519 } | 525 } |
520 | 526 |
521 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { | 527 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { |
522 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { | 528 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { |
523 DestroySystemBubble(); | 529 DestroySystemBubble(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 ConvertPointToWidget(this, &point); | 590 ConvertPointToWidget(this, &point); |
585 arrow_offset = point.x(); | 591 arrow_offset = point.x(); |
586 } | 592 } |
587 } | 593 } |
588 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); | 594 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); |
589 } | 595 } |
590 return true; | 596 return true; |
591 } | 597 } |
592 | 598 |
593 } // namespace ash | 599 } // namespace ash |
OLD | NEW |