| 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 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 web_notification_tray_ = nullptr; | 239 web_notification_tray_ = nullptr; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 242 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 243 AddTrayItem(base::MakeUnique<TrayUser>(this)); | 243 AddTrayItem(base::MakeUnique<TrayUser>(this)); |
| 244 | 244 |
| 245 // Crucially, this trailing padding has to be inside the user item(s). | 245 // Crucially, this trailing padding has to be inside the user item(s). |
| 246 // Otherwise it could be a main axis margin on the tray's box layout. | 246 // Otherwise it could be a main axis margin on the tray's box layout. |
| 247 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); | 247 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); |
| 248 | 248 |
| 249 tray_accessibility_ = new TrayAccessibility(this); | |
| 250 tray_update_ = new TrayUpdate(this); | |
| 251 | |
| 252 AddTrayItem(base::MakeUnique<TraySessionLengthLimit>(this)); | 249 AddTrayItem(base::MakeUnique<TraySessionLengthLimit>(this)); |
| 253 AddTrayItem(base::MakeUnique<TrayEnterprise>(this)); | 250 tray_enterprise_ = new TrayEnterprise(this); |
| 251 AddTrayItem(base::WrapUnique(tray_enterprise_)); |
| 254 tray_supervised_user_ = new TraySupervisedUser(this); | 252 tray_supervised_user_ = new TraySupervisedUser(this); |
| 255 AddTrayItem(base::WrapUnique(tray_supervised_user_)); | 253 AddTrayItem(base::WrapUnique(tray_supervised_user_)); |
| 256 AddTrayItem(base::MakeUnique<TrayIME>(this)); | 254 AddTrayItem(base::MakeUnique<TrayIME>(this)); |
| 255 tray_accessibility_ = new TrayAccessibility(this); |
| 257 AddTrayItem(base::WrapUnique(tray_accessibility_)); | 256 AddTrayItem(base::WrapUnique(tray_accessibility_)); |
| 258 AddTrayItem(base::MakeUnique<TrayTracing>(this)); | 257 AddTrayItem(base::MakeUnique<TrayTracing>(this)); |
| 259 AddTrayItem( | 258 AddTrayItem( |
| 260 base::MakeUnique<TrayPower>(this, message_center::MessageCenter::Get())); | 259 base::MakeUnique<TrayPower>(this, message_center::MessageCenter::Get())); |
| 261 tray_network_ = new TrayNetwork(this); | 260 tray_network_ = new TrayNetwork(this); |
| 262 AddTrayItem(base::WrapUnique(tray_network_)); | 261 AddTrayItem(base::WrapUnique(tray_network_)); |
| 263 AddTrayItem(base::MakeUnique<TrayVPN>(this)); | 262 AddTrayItem(base::MakeUnique<TrayVPN>(this)); |
| 264 AddTrayItem(base::MakeUnique<TrayBluetooth>(this)); | 263 AddTrayItem(base::MakeUnique<TrayBluetooth>(this)); |
| 265 tray_cast_ = new TrayCast(this); | 264 tray_cast_ = new TrayCast(this); |
| 266 AddTrayItem(base::WrapUnique(tray_cast_)); | 265 AddTrayItem(base::WrapUnique(tray_cast_)); |
| 267 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); | 266 screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); |
| 268 AddTrayItem(base::WrapUnique(screen_capture_tray_item_)); | 267 AddTrayItem(base::WrapUnique(screen_capture_tray_item_)); |
| 269 screen_share_tray_item_ = new ScreenShareTrayItem(this); | 268 screen_share_tray_item_ = new ScreenShareTrayItem(this); |
| 270 AddTrayItem(base::WrapUnique(screen_share_tray_item_)); | 269 AddTrayItem(base::WrapUnique(screen_share_tray_item_)); |
| 271 AddTrayItem(base::MakeUnique<MultiProfileMediaTrayItem>(this)); | 270 AddTrayItem(base::MakeUnique<MultiProfileMediaTrayItem>(this)); |
| 272 tray_audio_ = new TrayAudio(this); | 271 tray_audio_ = new TrayAudio(this); |
| 273 AddTrayItem(base::WrapUnique(tray_audio_)); | 272 AddTrayItem(base::WrapUnique(tray_audio_)); |
| 274 AddTrayItem(base::MakeUnique<TrayBrightness>(this)); | 273 AddTrayItem(base::MakeUnique<TrayBrightness>(this)); |
| 275 AddTrayItem(base::MakeUnique<TrayCapsLock>(this)); | 274 AddTrayItem(base::MakeUnique<TrayCapsLock>(this)); |
| 276 // TODO(jamescook): Remove this when mus has support for display management | 275 // TODO(jamescook): Remove this when mus has support for display management |
| 277 // and we have a DisplayManager equivalent. See http://crbug.com/548429 | 276 // and we have a DisplayManager equivalent. See http://crbug.com/548429 |
| 278 std::unique_ptr<SystemTrayItem> tray_rotation_lock = | 277 std::unique_ptr<SystemTrayItem> tray_rotation_lock = |
| 279 delegate->CreateRotationLockTrayItem(this); | 278 delegate->CreateRotationLockTrayItem(this); |
| 280 if (tray_rotation_lock) | 279 if (tray_rotation_lock) |
| 281 AddTrayItem(std::move(tray_rotation_lock)); | 280 AddTrayItem(std::move(tray_rotation_lock)); |
| 281 tray_update_ = new TrayUpdate(this); |
| 282 AddTrayItem(base::WrapUnique(tray_update_)); | 282 AddTrayItem(base::WrapUnique(tray_update_)); |
| 283 tray_tiles_ = new TrayTiles(this); | 283 tray_tiles_ = new TrayTiles(this); |
| 284 AddTrayItem(base::WrapUnique(tray_tiles_)); | 284 AddTrayItem(base::WrapUnique(tray_tiles_)); |
| 285 tray_system_info_ = new TraySystemInfo(this); | 285 tray_system_info_ = new TraySystemInfo(this); |
| 286 AddTrayItem(base::WrapUnique(tray_system_info_)); | 286 AddTrayItem(base::WrapUnique(tray_system_info_)); |
| 287 // Leading padding. | 287 // Leading padding. |
| 288 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); | 288 AddTrayItem(base::MakeUnique<PaddingTrayItem>()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void SystemTray::AddTrayItem(std::unique_ptr<SystemTrayItem> item) { | 291 void SystemTray::AddTrayItem(std::unique_ptr<SystemTrayItem> item) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 } | 604 } |
| 605 | 605 |
| 606 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { | 606 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { |
| 607 HideBubbleWithView(bubble_view); | 607 HideBubbleWithView(bubble_view); |
| 608 } | 608 } |
| 609 | 609 |
| 610 TrayCast* SystemTray::GetTrayCastForTesting() const { | 610 TrayCast* SystemTray::GetTrayCastForTesting() const { |
| 611 return tray_cast_; | 611 return tray_cast_; |
| 612 } | 612 } |
| 613 | 613 |
| 614 TrayEnterprise* SystemTray::GetTrayEnterpriseForTesting() const { |
| 615 return tray_enterprise_; |
| 616 } |
| 617 |
| 614 TrayNetwork* SystemTray::GetTrayNetworkForTesting() const { | 618 TrayNetwork* SystemTray::GetTrayNetworkForTesting() const { |
| 615 return tray_network_; | 619 return tray_network_; |
| 616 } | 620 } |
| 617 | 621 |
| 618 TraySupervisedUser* SystemTray::GetTraySupervisedUserForTesting() const { | 622 TraySupervisedUser* SystemTray::GetTraySupervisedUserForTesting() const { |
| 619 return tray_supervised_user_; | 623 return tray_supervised_user_; |
| 620 } | 624 } |
| 621 | 625 |
| 622 TraySystemInfo* SystemTray::GetTraySystemInfoForTesting() const { | 626 TraySystemInfo* SystemTray::GetTraySystemInfoForTesting() const { |
| 623 return tray_system_info_; | 627 return tray_system_info_; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 .work_area() | 720 .work_area() |
| 717 .height(); | 721 .height(); |
| 718 if (work_area_height > 0) { | 722 if (work_area_height > 0) { |
| 719 UMA_HISTOGRAM_CUSTOM_COUNTS( | 723 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 720 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 724 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 721 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 725 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 722 } | 726 } |
| 723 } | 727 } |
| 724 | 728 |
| 725 } // namespace ash | 729 } // namespace ash |
| OLD | NEW |