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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/key_event_watcher.h" | 11 #include "ash/key_event_watcher.h" |
12 #include "ash/login_status.h" | 12 #include "ash/login_status.h" |
13 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
15 #include "ash/session/session_controller.h" | 15 #include "ash/session/session_controller.h" |
16 #include "ash/shelf/wm_shelf.h" | 16 #include "ash/shelf/wm_shelf.h" |
17 #include "ash/shelf/wm_shelf_util.h" | 17 #include "ash/shelf/wm_shelf_util.h" |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/shell_port.h" |
19 #include "ash/strings/grit/ash_strings.h" | 20 #include "ash/strings/grit/ash_strings.h" |
20 #include "ash/system/audio/tray_audio.h" | 21 #include "ash/system/audio/tray_audio.h" |
21 #include "ash/system/bluetooth/tray_bluetooth.h" | 22 #include "ash/system/bluetooth/tray_bluetooth.h" |
22 #include "ash/system/brightness/tray_brightness.h" | 23 #include "ash/system/brightness/tray_brightness.h" |
23 #include "ash/system/cast/tray_cast.h" | 24 #include "ash/system/cast/tray_cast.h" |
24 #include "ash/system/date/tray_system_info.h" | 25 #include "ash/system/date/tray_system_info.h" |
25 #include "ash/system/enterprise/tray_enterprise.h" | 26 #include "ash/system/enterprise/tray_enterprise.h" |
26 #include "ash/system/ime/tray_ime_chromeos.h" | 27 #include "ash/system/ime/tray_ime_chromeos.h" |
27 #include "ash/system/media_security/multi_profile_media_tray_item.h" | 28 #include "ash/system/media_security/multi_profile_media_tray_item.h" |
28 #include "ash/system/network/tray_network.h" | 29 #include "ash/system/network/tray_network.h" |
(...skipping 11 matching lines...) Expand all Loading... |
40 #include "ash/system/tray/tray_bubble_wrapper.h" | 41 #include "ash/system/tray/tray_bubble_wrapper.h" |
41 #include "ash/system/tray/tray_constants.h" | 42 #include "ash/system/tray/tray_constants.h" |
42 #include "ash/system/tray_accessibility.h" | 43 #include "ash/system/tray_accessibility.h" |
43 #include "ash/system/tray_caps_lock.h" | 44 #include "ash/system/tray_caps_lock.h" |
44 #include "ash/system/tray_tracing.h" | 45 #include "ash/system/tray_tracing.h" |
45 #include "ash/system/update/tray_update.h" | 46 #include "ash/system/update/tray_update.h" |
46 #include "ash/system/user/tray_user.h" | 47 #include "ash/system/user/tray_user.h" |
47 #include "ash/system/web_notification/web_notification_tray.h" | 48 #include "ash/system/web_notification/web_notification_tray.h" |
48 #include "ash/wm/container_finder.h" | 49 #include "ash/wm/container_finder.h" |
49 #include "ash/wm/widget_finder.h" | 50 #include "ash/wm/widget_finder.h" |
50 #include "ash/wm_shell.h" | |
51 #include "ash/wm_window.h" | 51 #include "ash/wm_window.h" |
52 #include "base/logging.h" | 52 #include "base/logging.h" |
53 #include "base/memory/ptr_util.h" | 53 #include "base/memory/ptr_util.h" |
54 #include "base/metrics/histogram_macros.h" | 54 #include "base/metrics/histogram_macros.h" |
55 #include "base/timer/timer.h" | 55 #include "base/timer/timer.h" |
56 #include "ui/base/accelerators/accelerator.h" | 56 #include "ui/base/accelerators/accelerator.h" |
57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
58 #include "ui/compositor/layer.h" | 58 #include "ui/compositor/layer.h" |
59 #include "ui/display/display.h" | 59 #include "ui/display/display.h" |
60 #include "ui/display/screen.h" | 60 #include "ui/display/screen.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 std::vector<SystemTrayItem*> SystemTray::GetTrayItems() const { | 326 std::vector<SystemTrayItem*> SystemTray::GetTrayItems() const { |
327 std::vector<SystemTrayItem*> result; | 327 std::vector<SystemTrayItem*> result; |
328 for (const auto& item : items_) | 328 for (const auto& item : items_) |
329 result.push_back(item.get()); | 329 result.push_back(item.get()); |
330 return result; | 330 return result; |
331 } | 331 } |
332 | 332 |
333 void SystemTray::ShowDefaultView(BubbleCreationType creation_type) { | 333 void SystemTray::ShowDefaultView(BubbleCreationType creation_type) { |
334 if (creation_type != BUBBLE_USE_EXISTING) | 334 if (creation_type != BUBBLE_USE_EXISTING) |
335 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_MENU_OPENED); | 335 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_MENU_OPENED); |
336 ShowItems(GetTrayItems(), false, true, creation_type, false); | 336 ShowItems(GetTrayItems(), false, true, creation_type, false); |
337 } | 337 } |
338 | 338 |
339 void SystemTray::ShowPersistentDefaultView() { | 339 void SystemTray::ShowPersistentDefaultView() { |
340 ShowItems(GetTrayItems(), false, false, BUBBLE_CREATE_NEW, true); | 340 ShowItems(GetTrayItems(), false, false, BUBBLE_CREATE_NEW, true); |
341 } | 341 } |
342 | 342 |
343 void SystemTray::ShowDetailedView(SystemTrayItem* item, | 343 void SystemTray::ShowDetailedView(SystemTrayItem* item, |
344 int close_delay, | 344 int close_delay, |
345 bool activate, | 345 bool activate, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 void SystemTray::ActivateAndStartNavigation(const ui::KeyEvent& key_event) { | 663 void SystemTray::ActivateAndStartNavigation(const ui::KeyEvent& key_event) { |
664 if (!system_bubble_) | 664 if (!system_bubble_) |
665 return; | 665 return; |
666 ActivateBubble(); | 666 ActivateBubble(); |
667 | 667 |
668 views::Widget* widget = GetSystemBubble()->bubble_view()->GetWidget(); | 668 views::Widget* widget = GetSystemBubble()->bubble_view()->GetWidget(); |
669 widget->GetFocusManager()->OnKeyEvent(key_event); | 669 widget->GetFocusManager()->OnKeyEvent(key_event); |
670 } | 670 } |
671 | 671 |
672 void SystemTray::CreateKeyEventWatcher() { | 672 void SystemTray::CreateKeyEventWatcher() { |
673 key_event_watcher_ = WmShell::Get()->CreateKeyEventWatcher(); | 673 key_event_watcher_ = ShellPort::Get()->CreateKeyEventWatcher(); |
674 // mustash does not yet support KeyEventWatcher. http://crbug.com/649600. | 674 // mustash does not yet support KeyEventWatcher. http://crbug.com/649600. |
675 if (!key_event_watcher_) | 675 if (!key_event_watcher_) |
676 return; | 676 return; |
677 key_event_watcher_->AddKeyEventCallback( | 677 key_event_watcher_->AddKeyEventCallback( |
678 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE), | 678 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE), |
679 base::Bind(&SystemTray::CloseBubble, base::Unretained(this))); | 679 base::Bind(&SystemTray::CloseBubble, base::Unretained(this))); |
680 key_event_watcher_->AddKeyEventCallback( | 680 key_event_watcher_->AddKeyEventCallback( |
681 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE), | 681 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE), |
682 base::Bind(&SystemTray::ActivateAndStartNavigation, | 682 base::Bind(&SystemTray::ActivateAndStartNavigation, |
683 base::Unretained(this))); | 683 base::Unretained(this))); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 .work_area() | 743 .work_area() |
744 .height(); | 744 .height(); |
745 if (work_area_height > 0) { | 745 if (work_area_height > 0) { |
746 UMA_HISTOGRAM_CUSTOM_COUNTS( | 746 UMA_HISTOGRAM_CUSTOM_COUNTS( |
747 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 747 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
748 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 748 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 } // namespace ash | 752 } // namespace ash |
OLD | NEW |