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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return ((system_bubble_.get() && | 358 return ((system_bubble_.get() && |
359 system_bubble_->bubble()->IsVisible()) || | 359 system_bubble_->bubble()->IsVisible()) || |
360 (notification_bubble_.get() && | 360 (notification_bubble_.get() && |
361 notification_bubble_->bubble()->IsVisible())); | 361 notification_bubble_->bubble()->IsVisible())); |
362 } | 362 } |
363 | 363 |
364 bool SystemTray::IsMouseInNotificationBubble() const { | 364 bool SystemTray::IsMouseInNotificationBubble() const { |
365 if (!notification_bubble_) | 365 if (!notification_bubble_) |
366 return false; | 366 return false; |
367 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( | 367 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( |
368 Shell::GetScreen()->GetCursorScreenPoint()); | 368 gfx::Screen::GetScreen()->GetCursorScreenPoint()); |
369 } | 369 } |
370 | 370 |
371 bool SystemTray::CloseSystemBubble() const { | 371 bool SystemTray::CloseSystemBubble() const { |
372 if (!system_bubble_) | 372 if (!system_bubble_) |
373 return false; | 373 return false; |
374 system_bubble_->bubble()->Close(); | 374 system_bubble_->bubble()->Close(); |
375 return true; | 375 return true; |
376 } | 376 } |
377 | 377 |
378 views::View* SystemTray::GetHelpButtonView() const { | 378 views::View* SystemTray::GetHelpButtonView() const { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 void SystemTray::UpdateWebNotifications() { | 589 void SystemTray::UpdateWebNotifications() { |
590 TrayBubbleView* bubble_view = NULL; | 590 TrayBubbleView* bubble_view = NULL; |
591 if (notification_bubble_) | 591 if (notification_bubble_) |
592 bubble_view = notification_bubble_->bubble_view(); | 592 bubble_view = notification_bubble_->bubble_view(); |
593 else if (system_bubble_) | 593 else if (system_bubble_) |
594 bubble_view = system_bubble_->bubble_view(); | 594 bubble_view = system_bubble_->bubble_view(); |
595 | 595 |
596 int height = 0; | 596 int height = 0; |
597 if (bubble_view) { | 597 if (bubble_view) { |
598 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( | 598 gfx::Rect work_area = |
599 bubble_view->GetWidget()->GetNativeView()).work_area(); | 599 gfx::Screen::GetScreen() |
| 600 ->GetDisplayNearestWindow(bubble_view->GetWidget()->GetNativeView()) |
| 601 .work_area(); |
600 if (GetShelfLayoutManager()->GetAlignment() != SHELF_ALIGNMENT_TOP) { | 602 if (GetShelfLayoutManager()->GetAlignment() != SHELF_ALIGNMENT_TOP) { |
601 height = std::max( | 603 height = std::max( |
602 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); | 604 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); |
603 } else { | 605 } else { |
604 height = std::max( | 606 height = std::max( |
605 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); | 607 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); |
606 } | 608 } |
607 } | 609 } |
608 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); | 610 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); |
609 } | 611 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 system_bubble_.reset(); | 735 system_bubble_.reset(); |
734 // When closing a system bubble with the alternate shelf layout, we need to | 736 // When closing a system bubble with the alternate shelf layout, we need to |
735 // turn off the active tinting of the shelf. | 737 // turn off the active tinting of the shelf. |
736 if (full_system_tray_menu_) { | 738 if (full_system_tray_menu_) { |
737 SetDrawBackgroundAsActive(false); | 739 SetDrawBackgroundAsActive(false); |
738 full_system_tray_menu_ = false; | 740 full_system_tray_menu_ = false; |
739 } | 741 } |
740 } | 742 } |
741 | 743 |
742 } // namespace ash | 744 } // namespace ash |
OLD | NEW |