| 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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/key_event_watcher.h" | 7 #include "ash/common/key_event_watcher.h" |
| 8 #include "ash/common/login_status.h" | 8 #include "ash/common/login_status.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 TrayBackgroundView::Initialize(); | 203 TrayBackgroundView::Initialize(); |
| 204 CreateItems(delegate); | 204 CreateItems(delegate); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void SystemTray::Shutdown() { | 207 void SystemTray::Shutdown() { |
| 208 DCHECK(web_notification_tray_); | 208 DCHECK(web_notification_tray_); |
| 209 web_notification_tray_ = nullptr; | 209 web_notification_tray_ = nullptr; |
| 210 } | 210 } |
| 211 | 211 |
| 212 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 212 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
| 213 WmShell* wm_shell = WmShell::Get(); | |
| 214 #if !defined(OS_WIN) | 213 #if !defined(OS_WIN) |
| 215 // Create user items for each possible user. | 214 // Create user items for each possible user. |
| 216 int maximum_user_profiles = | 215 int maximum_user_profiles = WmShell::Get() |
| 217 wm_shell->GetSessionStateDelegate()->GetMaximumNumberOfLoggedInUsers(); | 216 ->GetSessionStateDelegate() |
| 217 ->GetMaximumNumberOfLoggedInUsers(); |
| 218 for (int i = 0; i < maximum_user_profiles; i++) | 218 for (int i = 0; i < maximum_user_profiles; i++) |
| 219 AddTrayItem(new TrayUser(this, i)); | 219 AddTrayItem(new TrayUser(this, i)); |
| 220 | 220 |
| 221 if (maximum_user_profiles > 1) { | 221 if (maximum_user_profiles > 1) { |
| 222 // Add a special double line separator between users and the rest of the | 222 // Add a special double line separator between users and the rest of the |
| 223 // menu if more than one user is logged in. | 223 // menu if more than one user is logged in. |
| 224 AddTrayItem(new TrayUserSeparator(this)); | 224 AddTrayItem(new TrayUserSeparator(this)); |
| 225 } | 225 } |
| 226 #endif | 226 #endif |
| 227 | 227 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (tray_rotation_lock) | 259 if (tray_rotation_lock) |
| 260 AddTrayItem(tray_rotation_lock.release()); | 260 AddTrayItem(tray_rotation_lock.release()); |
| 261 AddTrayItem(new TraySettings(this)); | 261 AddTrayItem(new TraySettings(this)); |
| 262 AddTrayItem(tray_update_); | 262 AddTrayItem(tray_update_); |
| 263 AddTrayItem(tray_date_); | 263 AddTrayItem(tray_date_); |
| 264 #elif defined(OS_WIN) | 264 #elif defined(OS_WIN) |
| 265 AddTrayItem(tray_accessibility_); | 265 AddTrayItem(tray_accessibility_); |
| 266 AddTrayItem(tray_update_); | 266 AddTrayItem(tray_update_); |
| 267 AddTrayItem(tray_date_); | 267 AddTrayItem(tray_date_); |
| 268 #endif | 268 #endif |
| 269 | |
| 270 SetVisible(wm_shell->system_tray_delegate()->GetTrayVisibilityOnStartup()); | |
| 271 } | 269 } |
| 272 | 270 |
| 273 void SystemTray::AddTrayItem(SystemTrayItem* item) { | 271 void SystemTray::AddTrayItem(SystemTrayItem* item) { |
| 274 items_.push_back(item); | 272 items_.push_back(item); |
| 275 | 273 |
| 276 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 274 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 277 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); | 275 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); |
| 278 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); | 276 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); |
| 279 | 277 |
| 280 if (tray_item) { | 278 if (tray_item) { |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 .work_area() | 876 .work_area() |
| 879 .height(); | 877 .height(); |
| 880 if (work_area_height > 0) { | 878 if (work_area_height > 0) { |
| 881 UMA_HISTOGRAM_CUSTOM_COUNTS( | 879 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 882 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 880 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 883 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 881 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 884 } | 882 } |
| 885 } | 883 } |
| 886 | 884 |
| 887 } // namespace ash | 885 } // namespace ash |
| OLD | NEW |