| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "media/audio/win/core_audio_util_win.h" | 66 #include "media/audio/win/core_audio_util_win.h" |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 using views::TrayBubbleView; | 69 using views::TrayBubbleView; |
| 70 | 70 |
| 71 namespace ash { | 71 namespace ash { |
| 72 | 72 |
| 73 // The minimum width of the system tray menu width. | 73 // The minimum width of the system tray menu width. |
| 74 const int kMinimumSystemTrayMenuWidth = 300; | 74 const int kMinimumSystemTrayMenuWidth = 300; |
| 75 | 75 |
| 76 namespace internal { | |
| 77 | |
| 78 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper | 76 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper |
| 79 // instances for a bubble. | 77 // instances for a bubble. |
| 80 | 78 |
| 81 class SystemBubbleWrapper { | 79 class SystemBubbleWrapper { |
| 82 public: | 80 public: |
| 83 // Takes ownership of |bubble|. | 81 // Takes ownership of |bubble|. |
| 84 explicit SystemBubbleWrapper(internal::SystemTrayBubble* bubble) | 82 explicit SystemBubbleWrapper(SystemTrayBubble* bubble) |
| 85 : bubble_(bubble), | 83 : bubble_(bubble), is_persistent_(false) {} |
| 86 is_persistent_(false) { | |
| 87 } | |
| 88 | 84 |
| 89 // Initializes the bubble view and creates |bubble_wrapper_|. | 85 // Initializes the bubble view and creates |bubble_wrapper_|. |
| 90 void InitView(TrayBackgroundView* tray, | 86 void InitView(TrayBackgroundView* tray, |
| 91 views::View* anchor, | 87 views::View* anchor, |
| 92 TrayBubbleView::InitParams* init_params, | 88 TrayBubbleView::InitParams* init_params, |
| 93 bool is_persistent) { | 89 bool is_persistent) { |
| 94 DCHECK(anchor); | 90 DCHECK(anchor); |
| 95 user::LoginStatus login_status = | 91 user::LoginStatus login_status = |
| 96 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); | 92 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); |
| 97 bubble_->InitView(anchor, login_status, init_params); | 93 bubble_->InitView(anchor, login_status, init_params); |
| 98 bubble_wrapper_.reset( | 94 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_->bubble_view())); |
| 99 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); | |
| 100 if (ash::switches::UseAlternateShelfLayout()) { | 95 if (ash::switches::UseAlternateShelfLayout()) { |
| 101 // The system bubble should not have an arrow. | 96 // The system bubble should not have an arrow. |
| 102 bubble_->bubble_view()->SetArrowPaintType( | 97 bubble_->bubble_view()->SetArrowPaintType( |
| 103 views::BubbleBorder::PAINT_NONE); | 98 views::BubbleBorder::PAINT_NONE); |
| 104 } | 99 } |
| 105 is_persistent_ = is_persistent; | 100 is_persistent_ = is_persistent; |
| 106 | 101 |
| 107 // 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. |
| 108 if (Shell::GetInstance()->accessibility_delegate()-> | 103 if (Shell::GetInstance()->accessibility_delegate()-> |
| 109 IsSpokenFeedbackEnabled()) { | 104 IsSpokenFeedbackEnabled()) { |
| 110 bubble_->FocusDefaultIfNeeded(); | 105 bubble_->FocusDefaultIfNeeded(); |
| 111 } | 106 } |
| 112 } | 107 } |
| 113 | 108 |
| 114 // Convenience accessors: | 109 // Convenience accessors: |
| 115 SystemTrayBubble* bubble() const { return bubble_.get(); } | 110 SystemTrayBubble* bubble() const { return bubble_.get(); } |
| 116 SystemTrayBubble::BubbleType bubble_type() const { | 111 SystemTrayBubble::BubbleType bubble_type() const { |
| 117 return bubble_->bubble_type(); | 112 return bubble_->bubble_type(); |
| 118 } | 113 } |
| 119 TrayBubbleView* bubble_view() const { return bubble_->bubble_view(); } | 114 TrayBubbleView* bubble_view() const { return bubble_->bubble_view(); } |
| 120 bool is_persistent() const { return is_persistent_; } | 115 bool is_persistent() const { return is_persistent_; } |
| 121 | 116 |
| 122 private: | 117 private: |
| 123 scoped_ptr<internal::SystemTrayBubble> bubble_; | 118 scoped_ptr<SystemTrayBubble> bubble_; |
| 124 scoped_ptr<internal::TrayBubbleWrapper> bubble_wrapper_; | 119 scoped_ptr<TrayBubbleWrapper> bubble_wrapper_; |
| 125 bool is_persistent_; | 120 bool is_persistent_; |
| 126 | 121 |
| 127 DISALLOW_COPY_AND_ASSIGN(SystemBubbleWrapper); | 122 DISALLOW_COPY_AND_ASSIGN(SystemBubbleWrapper); |
| 128 }; | 123 }; |
| 129 | 124 |
| 130 } // namespace internal | |
| 131 | 125 |
| 132 // SystemTray | 126 // SystemTray |
| 133 | 127 |
| 134 using internal::SystemTrayBubble; | 128 SystemTray::SystemTray(StatusAreaWidget* status_area_widget) |
| 135 | 129 : TrayBackgroundView(status_area_widget), |
| 136 SystemTray::SystemTray(internal::StatusAreaWidget* status_area_widget) | |
| 137 : internal::TrayBackgroundView(status_area_widget), | |
| 138 items_(), | 130 items_(), |
| 139 default_bubble_height_(0), | 131 default_bubble_height_(0), |
| 140 hide_notifications_(false), | 132 hide_notifications_(false), |
| 141 full_system_tray_menu_(false), | 133 full_system_tray_menu_(false), |
| 142 tray_accessibility_(NULL), | 134 tray_accessibility_(NULL), |
| 143 tray_date_(NULL) { | 135 tray_date_(NULL) { |
| 144 SetContentsBackground(); | 136 SetContentsBackground(); |
| 145 } | 137 } |
| 146 | 138 |
| 147 SystemTray::~SystemTray() { | 139 SystemTray::~SystemTray() { |
| 148 // Destroy any child views that might have back pointers before ~View(). | 140 // Destroy any child views that might have back pointers before ~View(). |
| 149 system_bubble_.reset(); | 141 system_bubble_.reset(); |
| 150 notification_bubble_.reset(); | 142 notification_bubble_.reset(); |
| 151 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); | 143 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); |
| 152 it != items_.end(); | 144 it != items_.end(); |
| 153 ++it) { | 145 ++it) { |
| 154 (*it)->DestroyTrayView(); | 146 (*it)->DestroyTrayView(); |
| 155 } | 147 } |
| 156 } | 148 } |
| 157 | 149 |
| 158 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { | 150 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate) { |
| 159 internal::TrayBackgroundView::Initialize(); | 151 TrayBackgroundView::Initialize(); |
| 160 CreateItems(delegate); | 152 CreateItems(delegate); |
| 161 } | 153 } |
| 162 | 154 |
| 163 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 155 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 164 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 165 AddTrayItem(new internal::TraySessionLengthLimit(this)); | 157 AddTrayItem(new TraySessionLengthLimit(this)); |
| 166 #endif | 158 #endif |
| 167 #if !defined(OS_WIN) | 159 #if !defined(OS_WIN) |
| 168 // Create user items for each possible user. | 160 // Create user items for each possible user. |
| 169 ash::Shell* shell = ash::Shell::GetInstance(); | 161 ash::Shell* shell = ash::Shell::GetInstance(); |
| 170 int maximum_user_profiles = | 162 int maximum_user_profiles = |
| 171 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers(); | 163 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers(); |
| 172 for (int i = 0; i < maximum_user_profiles; i++) | 164 for (int i = 0; i < maximum_user_profiles; i++) |
| 173 AddTrayItem(new internal::TrayUser(this, i)); | 165 AddTrayItem(new TrayUser(this, i)); |
| 174 | 166 |
| 175 if (maximum_user_profiles > 1) { | 167 if (maximum_user_profiles > 1) { |
| 176 // Add a special double line separator between users and the rest of the | 168 // Add a special double line separator between users and the rest of the |
| 177 // menu if more then one user is logged in. | 169 // menu if more then one user is logged in. |
| 178 AddTrayItem(new internal::TrayUserSeparator(this)); | 170 AddTrayItem(new TrayUserSeparator(this)); |
| 179 } | 171 } |
| 180 #endif | 172 #endif |
| 181 | 173 |
| 182 tray_accessibility_ = new internal::TrayAccessibility(this); | 174 tray_accessibility_ = new TrayAccessibility(this); |
| 183 tray_date_ = new internal::TrayDate(this); | 175 tray_date_ = new TrayDate(this); |
| 184 | 176 |
| 185 #if defined(OS_CHROMEOS) | 177 #if defined(OS_CHROMEOS) |
| 186 AddTrayItem(new internal::TrayEnterprise(this)); | 178 AddTrayItem(new TrayEnterprise(this)); |
| 187 AddTrayItem(new internal::TrayLocallyManagedUser(this)); | 179 AddTrayItem(new TrayLocallyManagedUser(this)); |
| 188 AddTrayItem(new internal::TrayIME(this)); | 180 AddTrayItem(new TrayIME(this)); |
| 189 AddTrayItem(tray_accessibility_); | 181 AddTrayItem(tray_accessibility_); |
| 190 AddTrayItem(new internal::TrayTracing(this)); | 182 AddTrayItem(new TrayTracing(this)); |
| 191 AddTrayItem( | 183 AddTrayItem(new TrayPower(this, message_center::MessageCenter::Get())); |
| 192 new internal::TrayPower(this, message_center::MessageCenter::Get())); | 184 AddTrayItem(new TrayNetwork(this)); |
| 193 AddTrayItem(new internal::TrayNetwork(this)); | 185 AddTrayItem(new TrayVPN(this)); |
| 194 AddTrayItem(new internal::TrayVPN(this)); | 186 AddTrayItem(new TraySms(this)); |
| 195 AddTrayItem(new internal::TraySms(this)); | 187 AddTrayItem(new TrayBluetooth(this)); |
| 196 AddTrayItem(new internal::TrayBluetooth(this)); | 188 AddTrayItem(new TrayDrive(this)); |
| 197 AddTrayItem(new internal::TrayDrive(this)); | 189 AddTrayItem(new TrayDisplay(this)); |
| 198 AddTrayItem(new internal::TrayDisplay(this)); | 190 AddTrayItem(new ScreenCaptureTrayItem(this)); |
| 199 AddTrayItem(new internal::ScreenCaptureTrayItem(this)); | 191 AddTrayItem(new ScreenShareTrayItem(this)); |
| 200 AddTrayItem(new internal::ScreenShareTrayItem(this)); | 192 AddTrayItem(new TrayAudioChromeOs(this)); |
| 201 AddTrayItem(new internal::TrayAudioChromeOs(this)); | 193 AddTrayItem(new TrayBrightness(this)); |
| 202 AddTrayItem(new internal::TrayBrightness(this)); | 194 AddTrayItem(new TrayCapsLock(this)); |
| 203 AddTrayItem(new internal::TrayCapsLock(this)); | 195 AddTrayItem(new TraySettings(this)); |
| 204 AddTrayItem(new internal::TraySettings(this)); | 196 AddTrayItem(new TrayUpdate(this)); |
| 205 AddTrayItem(new internal::TrayUpdate(this)); | |
| 206 AddTrayItem(tray_date_); | 197 AddTrayItem(tray_date_); |
| 207 #elif defined(OS_WIN) | 198 #elif defined(OS_WIN) |
| 208 AddTrayItem(tray_accessibility_); | 199 AddTrayItem(tray_accessibility_); |
| 209 if (media::CoreAudioUtil::IsSupported()) | 200 if (media::CoreAudioUtil::IsSupported()) |
| 210 AddTrayItem(new internal::TrayAudioWin(this)); | 201 AddTrayItem(new TrayAudioWin(this)); |
| 211 AddTrayItem(new internal::TrayUpdate(this)); | 202 AddTrayItem(new TrayUpdate(this)); |
| 212 AddTrayItem(tray_date_); | 203 AddTrayItem(tray_date_); |
| 213 #elif defined(OS_LINUX) | 204 #elif defined(OS_LINUX) |
| 214 AddTrayItem(new internal::TrayIME(this)); | 205 AddTrayItem(new TrayIME(this)); |
| 215 AddTrayItem(tray_accessibility_); | 206 AddTrayItem(tray_accessibility_); |
| 216 AddTrayItem(new internal::TrayBluetooth(this)); | 207 AddTrayItem(new TrayBluetooth(this)); |
| 217 AddTrayItem(new internal::TrayDrive(this)); | 208 AddTrayItem(new TrayDrive(this)); |
| 218 AddTrayItem(new internal::TrayUpdate(this)); | 209 AddTrayItem(new TrayUpdate(this)); |
| 219 AddTrayItem(tray_date_); | 210 AddTrayItem(tray_date_); |
| 220 #endif | 211 #endif |
| 221 | 212 |
| 222 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> | 213 SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> |
| 223 GetTrayVisibilityOnStartup()); | 214 GetTrayVisibilityOnStartup()); |
| 224 } | 215 } |
| 225 | 216 |
| 226 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 217 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| 227 items_.push_back(item); | 218 items_.push_back(item); |
| 228 | 219 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 332 } |
| 342 | 333 |
| 343 bool SystemTray::HasSystemBubble() const { | 334 bool SystemTray::HasSystemBubble() const { |
| 344 return system_bubble_.get() != NULL; | 335 return system_bubble_.get() != NULL; |
| 345 } | 336 } |
| 346 | 337 |
| 347 bool SystemTray::HasNotificationBubble() const { | 338 bool SystemTray::HasNotificationBubble() const { |
| 348 return notification_bubble_.get() != NULL; | 339 return notification_bubble_.get() != NULL; |
| 349 } | 340 } |
| 350 | 341 |
| 351 internal::SystemTrayBubble* SystemTray::GetSystemBubble() { | 342 SystemTrayBubble* SystemTray::GetSystemBubble() { |
| 352 if (!system_bubble_) | 343 if (!system_bubble_) |
| 353 return NULL; | 344 return NULL; |
| 354 return system_bubble_->bubble(); | 345 return system_bubble_->bubble(); |
| 355 } | 346 } |
| 356 | 347 |
| 357 bool SystemTray::IsAnyBubbleVisible() const { | 348 bool SystemTray::IsAnyBubbleVisible() const { |
| 358 return ((system_bubble_.get() && | 349 return ((system_bubble_.get() && |
| 359 system_bubble_->bubble()->IsVisible()) || | 350 system_bubble_->bubble()->IsVisible()) || |
| 360 (notification_bubble_.get() && | 351 (notification_bubble_.get() && |
| 361 notification_bubble_->bubble()->IsVisible())); | 352 notification_bubble_->bubble()->IsVisible())); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 } | 485 } |
| 495 init_params.arrow_offset = arrow_offset; | 486 init_params.arrow_offset = arrow_offset; |
| 496 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) | 487 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) |
| 497 init_params.close_on_deactivate = !persistent; | 488 init_params.close_on_deactivate = !persistent; |
| 498 // For Volume and Brightness we don't want to show an arrow when | 489 // For Volume and Brightness we don't want to show an arrow when |
| 499 // they are shown in a bubble by themselves. | 490 // they are shown in a bubble by themselves. |
| 500 init_params.arrow_paint_type = views::BubbleBorder::PAINT_NORMAL; | 491 init_params.arrow_paint_type = views::BubbleBorder::PAINT_NORMAL; |
| 501 if (items.size() == 1 && items[0]->ShouldHideArrow()) | 492 if (items.size() == 1 && items[0]->ShouldHideArrow()) |
| 502 init_params.arrow_paint_type = views::BubbleBorder::PAINT_TRANSPARENT; | 493 init_params.arrow_paint_type = views::BubbleBorder::PAINT_TRANSPARENT; |
| 503 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); | 494 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); |
| 504 system_bubble_.reset(new internal::SystemBubbleWrapper(bubble)); | 495 system_bubble_.reset(new SystemBubbleWrapper(bubble)); |
| 505 system_bubble_->InitView(this, tray_container(), &init_params, persistent); | 496 system_bubble_->InitView(this, tray_container(), &init_params, persistent); |
| 506 } | 497 } |
| 507 // Save height of default view for creating detailed views directly. | 498 // Save height of default view for creating detailed views directly. |
| 508 if (!detailed) | 499 if (!detailed) |
| 509 default_bubble_height_ = system_bubble_->bubble_view()->height(); | 500 default_bubble_height_ = system_bubble_->bubble_view()->height(); |
| 510 | 501 |
| 511 if (detailed && items.size() > 0) | 502 if (detailed && items.size() > 0) |
| 512 detailed_item_ = items[0]; | 503 detailed_item_ = items[0]; |
| 513 else | 504 else |
| 514 detailed_item_ = NULL; | 505 detailed_item_ = NULL; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; | 542 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; |
| 552 } | 543 } |
| 553 TrayBubbleView::InitParams init_params(anchor_type, | 544 TrayBubbleView::InitParams init_params(anchor_type, |
| 554 GetAnchorAlignment(), | 545 GetAnchorAlignment(), |
| 555 kTrayPopupMinWidth, | 546 kTrayPopupMinWidth, |
| 556 kTrayPopupMaxWidth); | 547 kTrayPopupMaxWidth); |
| 557 init_params.first_item_has_no_margin = | 548 init_params.first_item_has_no_margin = |
| 558 ash::switches::UseAlternateShelfLayout(); | 549 ash::switches::UseAlternateShelfLayout(); |
| 559 init_params.arrow_color = kBackgroundColor; | 550 init_params.arrow_color = kBackgroundColor; |
| 560 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); | 551 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); |
| 561 notification_bubble_.reset( | 552 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble)); |
| 562 new internal::SystemBubbleWrapper(notification_bubble)); | |
| 563 notification_bubble_->InitView(this, anchor, &init_params, false); | 553 notification_bubble_->InitView(this, anchor, &init_params, false); |
| 564 | 554 |
| 565 if (notification_bubble->bubble_view()->child_count() == 0) { | 555 if (notification_bubble->bubble_view()->child_count() == 0) { |
| 566 // It is possible that none of the items generated actual notifications. | 556 // It is possible that none of the items generated actual notifications. |
| 567 DestroyNotificationBubble(); | 557 DestroyNotificationBubble(); |
| 568 return; | 558 return; |
| 569 } | 559 } |
| 570 if (hide_notifications_) | 560 if (hide_notifications_) |
| 571 notification_bubble->SetVisible(false); | 561 notification_bubble->SetVisible(false); |
| 572 else | 562 else |
| (...skipping 18 matching lines...) Expand all Loading... |
| 591 height = std::max( | 581 height = std::max( |
| 592 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); | 582 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); |
| 593 } | 583 } |
| 594 } | 584 } |
| 595 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); | 585 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); |
| 596 } | 586 } |
| 597 | 587 |
| 598 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { | 588 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { |
| 599 if (alignment == shelf_alignment()) | 589 if (alignment == shelf_alignment()) |
| 600 return; | 590 return; |
| 601 internal::TrayBackgroundView::SetShelfAlignment(alignment); | 591 TrayBackgroundView::SetShelfAlignment(alignment); |
| 602 UpdateAfterShelfAlignmentChange(alignment); | 592 UpdateAfterShelfAlignmentChange(alignment); |
| 603 // Destroy any existing bubble so that it is rebuilt correctly. | 593 // Destroy any existing bubble so that it is rebuilt correctly. |
| 604 CloseSystemBubbleAndDeactivateSystemTray(); | 594 CloseSystemBubbleAndDeactivateSystemTray(); |
| 605 // Rebuild any notification bubble. | 595 // Rebuild any notification bubble. |
| 606 if (notification_bubble_) { | 596 if (notification_bubble_) { |
| 607 notification_bubble_.reset(); | 597 notification_bubble_.reset(); |
| 608 UpdateNotificationBubble(); | 598 UpdateNotificationBubble(); |
| 609 } | 599 } |
| 610 } | 600 } |
| 611 | 601 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { | 669 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { |
| 680 HideBubbleWithView(bubble_view); | 670 HideBubbleWithView(bubble_view); |
| 681 } | 671 } |
| 682 | 672 |
| 683 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { | 673 views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { |
| 684 std::map<SystemTrayItem*, views::View*>::iterator it = | 674 std::map<SystemTrayItem*, views::View*>::iterator it = |
| 685 tray_item_map_.find(item); | 675 tray_item_map_.find(item); |
| 686 return it == tray_item_map_.end() ? NULL : it->second; | 676 return it == tray_item_map_.end() ? NULL : it->second; |
| 687 } | 677 } |
| 688 | 678 |
| 689 internal::TrayDate* SystemTray::GetTrayDateForTesting() const { | 679 TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } |
| 690 return tray_date_; | |
| 691 } | |
| 692 | 680 |
| 693 bool SystemTray::PerformAction(const ui::Event& event) { | 681 bool SystemTray::PerformAction(const ui::Event& event) { |
| 694 // If we're already showing the default view, hide it; otherwise, show it | 682 // If we're already showing the default view, hide it; otherwise, show it |
| 695 // (and hide any popup that's currently shown). | 683 // (and hide any popup that's currently shown). |
| 696 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { | 684 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { |
| 697 system_bubble_->bubble()->Close(); | 685 system_bubble_->bubble()->Close(); |
| 698 } else { | 686 } else { |
| 699 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; | 687 int arrow_offset = TrayBubbleView::InitParams::kArrowDefaultOffset; |
| 700 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { | 688 if (event.IsMouseEvent() || event.type() == ui::ET_GESTURE_TAP) { |
| 701 const ui::LocatedEvent& located_event = | 689 const ui::LocatedEvent& located_event = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 716 system_bubble_.reset(); | 704 system_bubble_.reset(); |
| 717 // When closing a system bubble with the alternate shelf layout, we need to | 705 // When closing a system bubble with the alternate shelf layout, we need to |
| 718 // turn off the active tinting of the shelf. | 706 // turn off the active tinting of the shelf. |
| 719 if (full_system_tray_menu_) { | 707 if (full_system_tray_menu_) { |
| 720 SetDrawBackgroundAsActive(false); | 708 SetDrawBackgroundAsActive(false); |
| 721 full_system_tray_menu_ = false; | 709 full_system_tray_menu_ = false; |
| 722 } | 710 } |
| 723 } | 711 } |
| 724 | 712 |
| 725 } // namespace ash | 713 } // namespace ash |
| OLD | NEW |