Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Side by Side Diff: ash/common/system/tray/system_tray.cc

Issue 2498293003: CrOS md user row adjustments (Closed)
Patch Set: is_active_user() Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/common/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 TrayBackgroundView::Initialize(); 248 TrayBackgroundView::Initialize();
249 CreateItems(delegate); 249 CreateItems(delegate);
250 } 250 }
251 251
252 void SystemTray::Shutdown() { 252 void SystemTray::Shutdown() {
253 DCHECK(web_notification_tray_); 253 DCHECK(web_notification_tray_);
254 web_notification_tray_ = nullptr; 254 web_notification_tray_ = nullptr;
255 } 255 }
256 256
257 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { 257 void SystemTray::CreateItems(SystemTrayDelegate* delegate) {
258 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial();
258 #if !defined(OS_WIN) 259 #if !defined(OS_WIN)
259 // Create user items for each possible user. 260 // Create user items for each possible user.
260 int maximum_user_profiles = WmShell::Get() 261 int maximum_user_profiles = WmShell::Get()
261 ->GetSessionStateDelegate() 262 ->GetSessionStateDelegate()
262 ->GetMaximumNumberOfLoggedInUsers(); 263 ->GetMaximumNumberOfLoggedInUsers();
263 for (int i = 0; i < maximum_user_profiles; i++) 264 for (int i = 0; i < maximum_user_profiles; i++)
264 AddTrayItem(new TrayUser(this, i)); 265 AddTrayItem(new TrayUser(this, i));
265 266
266 // Crucially, this trailing padding has to be inside the user item(s). 267 // Crucially, this trailing padding has to be inside the user item(s).
267 // Otherwise it could be a main axis margin on the tray's box layout. 268 // Otherwise it could be a main axis margin on the tray's box layout.
268 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 269 if (use_md)
269 AddTrayItem(new PaddingTrayItem()); 270 AddTrayItem(new PaddingTrayItem());
270 271
271 if (maximum_user_profiles > 1) { 272 if (!use_md && maximum_user_profiles > 1) {
272 // Add a special double line separator between users and the rest of the 273 // Add a special double line separator between users and the rest of the
273 // menu if more than one user is logged in. 274 // menu if more than one user is logged in.
274 AddTrayItem(new TrayUserSeparator(this)); 275 AddTrayItem(new TrayUserSeparator(this));
275 } 276 }
276 #endif 277 #endif
277 278
278 const bool use_material_design =
279 MaterialDesignController::IsSystemTrayMenuMaterial();
280 tray_accessibility_ = new TrayAccessibility(this); 279 tray_accessibility_ = new TrayAccessibility(this);
281 if (!use_material_design) 280 if (!use_md)
282 tray_date_ = new TrayDate(this); 281 tray_date_ = new TrayDate(this);
283 tray_update_ = new TrayUpdate(this); 282 tray_update_ = new TrayUpdate(this);
284 283
285 #if defined(OS_CHROMEOS) 284 #if defined(OS_CHROMEOS)
286 AddTrayItem(new TraySessionLengthLimit(this)); 285 AddTrayItem(new TraySessionLengthLimit(this));
287 AddTrayItem(new TrayEnterprise(this)); 286 AddTrayItem(new TrayEnterprise(this));
288 AddTrayItem(new TraySupervisedUser(this)); 287 AddTrayItem(new TraySupervisedUser(this));
289 AddTrayItem(new TrayIME(this)); 288 AddTrayItem(new TrayIME(this));
290 AddTrayItem(tray_accessibility_); 289 AddTrayItem(tray_accessibility_);
291 AddTrayItem(new TrayTracing(this)); 290 AddTrayItem(new TrayTracing(this));
(...skipping 12 matching lines...) Expand all
304 tray_audio_ = new TrayAudio(this); 303 tray_audio_ = new TrayAudio(this);
305 AddTrayItem(tray_audio_); 304 AddTrayItem(tray_audio_);
306 AddTrayItem(new TrayBrightness(this)); 305 AddTrayItem(new TrayBrightness(this));
307 AddTrayItem(new TrayCapsLock(this)); 306 AddTrayItem(new TrayCapsLock(this));
308 // TODO(jamescook): Remove this when mus has support for display management 307 // TODO(jamescook): Remove this when mus has support for display management
309 // and we have a DisplayManager equivalent. See http://crbug.com/548429 308 // and we have a DisplayManager equivalent. See http://crbug.com/548429
310 std::unique_ptr<SystemTrayItem> tray_rotation_lock = 309 std::unique_ptr<SystemTrayItem> tray_rotation_lock =
311 delegate->CreateRotationLockTrayItem(this); 310 delegate->CreateRotationLockTrayItem(this);
312 if (tray_rotation_lock) 311 if (tray_rotation_lock)
313 AddTrayItem(tray_rotation_lock.release()); 312 AddTrayItem(tray_rotation_lock.release());
314 if (!use_material_design) 313 if (!use_md)
315 AddTrayItem(new TraySettings(this)); 314 AddTrayItem(new TraySettings(this));
316 AddTrayItem(tray_update_); 315 AddTrayItem(tray_update_);
317 if (use_material_design) { 316 if (use_md) {
318 tray_tiles_ = new TrayTiles(this); 317 tray_tiles_ = new TrayTiles(this);
319 AddTrayItem(tray_tiles_); 318 AddTrayItem(tray_tiles_);
320 tray_system_info_ = new TraySystemInfo(this); 319 tray_system_info_ = new TraySystemInfo(this);
321 AddTrayItem(tray_system_info_); 320 AddTrayItem(tray_system_info_);
322 } else { 321 } else {
323 AddTrayItem(tray_date_); 322 AddTrayItem(tray_date_);
324 } 323 }
325 #elif defined(OS_WIN) 324 #elif defined(OS_WIN)
326 AddTrayItem(tray_accessibility_); 325 AddTrayItem(tray_accessibility_);
327 AddTrayItem(tray_update_); 326 AddTrayItem(tray_update_);
328 if (!use_material_design) 327 if (!use_md)
329 AddTrayItem(tray_date_); 328 AddTrayItem(tray_date_);
330 #endif 329 #endif
331 // Leading padding. 330 // Leading padding.
332 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 331 if (use_md)
333 AddTrayItem(new PaddingTrayItem()); 332 AddTrayItem(new PaddingTrayItem());
334 } 333 }
335 334
336 void SystemTray::AddTrayItem(SystemTrayItem* item) { 335 void SystemTray::AddTrayItem(SystemTrayItem* item) {
337 items_.push_back(item); 336 items_.push_back(item);
338 337
339 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 338 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
340 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); 339 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus());
341 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); 340 item->UpdateAfterShelfAlignmentChange(shelf_alignment());
342 341
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 .work_area() 905 .work_area()
907 .height(); 906 .height();
908 if (work_area_height > 0) { 907 if (work_area_height > 0) {
909 UMA_HISTOGRAM_CUSTOM_COUNTS( 908 UMA_HISTOGRAM_CUSTOM_COUNTS(
910 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 909 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
911 100 * bubble_view->height() / work_area_height, 1, 300, 100); 910 100 * bubble_view->height() / work_area_height, 1, 300, 100);
912 } 911 }
913 } 912 }
914 913
915 } // namespace ash 914 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698