| 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/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ash/system/user/tray_user.h" | 25 #include "ash/system/user/tray_user.h" |
| 26 #include "ash/system/user/tray_user_separator.h" | 26 #include "ash/system/user/tray_user_separator.h" |
| 27 #include "ash/system/web_notification/web_notification_tray.h" | 27 #include "ash/system/web_notification/web_notification_tray.h" |
| 28 #include "base/logging.h" | 28 #include "base/logging.h" |
| 29 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
| 30 #include "base/timer/timer.h" | 30 #include "base/timer/timer.h" |
| 31 #include "grit/ash_strings.h" | 31 #include "grit/ash_strings.h" |
| 32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/compositor/layer.h" | 34 #include "ui/compositor/layer.h" |
| 35 #include "ui/display/screen.h" |
| 35 #include "ui/events/event_constants.h" | 36 #include "ui/events/event_constants.h" |
| 36 #include "ui/gfx/canvas.h" | 37 #include "ui/gfx/canvas.h" |
| 37 #include "ui/gfx/screen.h" | |
| 38 #include "ui/gfx/skia_util.h" | 38 #include "ui/gfx/skia_util.h" |
| 39 #include "ui/views/border.h" | 39 #include "ui/views/border.h" |
| 40 #include "ui/views/controls/label.h" | 40 #include "ui/views/controls/label.h" |
| 41 #include "ui/views/layout/box_layout.h" | 41 #include "ui/views/layout/box_layout.h" |
| 42 #include "ui/views/layout/fill_layout.h" | 42 #include "ui/views/layout/fill_layout.h" |
| 43 #include "ui/views/view.h" | 43 #include "ui/views/view.h" |
| 44 | 44 |
| 45 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 46 #include "ash/system/chromeos/audio/tray_audio_chromeos.h" | 46 #include "ash/system/chromeos/audio/tray_audio_chromeos.h" |
| 47 #include "ash/system/chromeos/brightness/tray_brightness.h" | 47 #include "ash/system/chromeos/brightness/tray_brightness.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return ((system_bubble_.get() && | 357 return ((system_bubble_.get() && |
| 358 system_bubble_->bubble()->IsVisible()) || | 358 system_bubble_->bubble()->IsVisible()) || |
| 359 (notification_bubble_.get() && | 359 (notification_bubble_.get() && |
| 360 notification_bubble_->bubble()->IsVisible())); | 360 notification_bubble_->bubble()->IsVisible())); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool SystemTray::IsMouseInNotificationBubble() const { | 363 bool SystemTray::IsMouseInNotificationBubble() const { |
| 364 if (!notification_bubble_) | 364 if (!notification_bubble_) |
| 365 return false; | 365 return false; |
| 366 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( | 366 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( |
| 367 gfx::Screen::GetScreen()->GetCursorScreenPoint()); | 367 display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool SystemTray::CloseSystemBubble() const { | 370 bool SystemTray::CloseSystemBubble() const { |
| 371 if (!system_bubble_) | 371 if (!system_bubble_) |
| 372 return false; | 372 return false; |
| 373 system_bubble_->bubble()->Close(); | 373 system_bubble_->bubble()->Close(); |
| 374 return true; | 374 return true; |
| 375 } | 375 } |
| 376 | 376 |
| 377 views::View* SystemTray::GetHelpButtonView() const { | 377 views::View* SystemTray::GetHelpButtonView() const { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 void SystemTray::UpdateWebNotifications() { | 587 void SystemTray::UpdateWebNotifications() { |
| 588 TrayBubbleView* bubble_view = NULL; | 588 TrayBubbleView* bubble_view = NULL; |
| 589 if (notification_bubble_) | 589 if (notification_bubble_) |
| 590 bubble_view = notification_bubble_->bubble_view(); | 590 bubble_view = notification_bubble_->bubble_view(); |
| 591 else if (system_bubble_) | 591 else if (system_bubble_) |
| 592 bubble_view = system_bubble_->bubble_view(); | 592 bubble_view = system_bubble_->bubble_view(); |
| 593 | 593 |
| 594 int height = 0; | 594 int height = 0; |
| 595 if (bubble_view) { | 595 if (bubble_view) { |
| 596 gfx::Rect work_area = | 596 gfx::Rect work_area = |
| 597 gfx::Screen::GetScreen() | 597 display::Screen::GetScreen() |
| 598 ->GetDisplayNearestWindow(bubble_view->GetWidget()->GetNativeView()) | 598 ->GetDisplayNearestWindow(bubble_view->GetWidget()->GetNativeView()) |
| 599 .work_area(); | 599 .work_area(); |
| 600 height = | 600 height = |
| 601 std::max(0, work_area.height() - bubble_view->GetBoundsInScreen().y()); | 601 std::max(0, work_area.height() - bubble_view->GetBoundsInScreen().y()); |
| 602 } | 602 } |
| 603 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); | 603 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); |
| 604 } | 604 } |
| 605 | 605 |
| 606 base::string16 SystemTray::GetAccessibleTimeString( | 606 base::string16 SystemTray::GetAccessibleTimeString( |
| 607 const base::Time& now) const { | 607 const base::Time& now) const { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 system_bubble_.reset(); | 727 system_bubble_.reset(); |
| 728 // When closing a system bubble with the alternate shelf layout, we need to | 728 // When closing a system bubble with the alternate shelf layout, we need to |
| 729 // turn off the active tinting of the shelf. | 729 // turn off the active tinting of the shelf. |
| 730 if (full_system_tray_menu_) { | 730 if (full_system_tray_menu_) { |
| 731 SetDrawBackgroundAsActive(false); | 731 SetDrawBackgroundAsActive(false); |
| 732 full_system_tray_menu_ = false; | 732 full_system_tray_menu_ = false; |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 | 735 |
| 736 } // namespace ash | 736 } // namespace ash |
| OLD | NEW |