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

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

Issue 2498293003: CrOS md user row adjustments (Closed)
Patch Set: more stuff 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
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 "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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 TrayBackgroundView::Initialize(); 243 TrayBackgroundView::Initialize();
244 CreateItems(delegate); 244 CreateItems(delegate);
245 } 245 }
246 246
247 void SystemTray::Shutdown() { 247 void SystemTray::Shutdown() {
248 DCHECK(web_notification_tray_); 248 DCHECK(web_notification_tray_);
249 web_notification_tray_ = nullptr; 249 web_notification_tray_ = nullptr;
250 } 250 }
251 251
252 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { 252 void SystemTray::CreateItems(SystemTrayDelegate* delegate) {
253 const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial();
253 #if !defined(OS_WIN) 254 #if !defined(OS_WIN)
254 // Create user items for each possible user. 255 // Create user items for each possible user.
255 int maximum_user_profiles = WmShell::Get() 256 int maximum_user_profiles = WmShell::Get()
256 ->GetSessionStateDelegate() 257 ->GetSessionStateDelegate()
257 ->GetMaximumNumberOfLoggedInUsers(); 258 ->GetMaximumNumberOfLoggedInUsers();
258 for (int i = 0; i < maximum_user_profiles; i++) 259 for (int i = 0; i < maximum_user_profiles; i++)
259 AddTrayItem(new TrayUser(this, i)); 260 AddTrayItem(new TrayUser(this, i));
260 261
261 // Crucially, this trailing padding has to be inside the user item(s). 262 // Crucially, this trailing padding has to be inside the user item(s).
262 // Otherwise it could be a main axis margin on the tray's box layout. 263 // Otherwise it could be a main axis margin on the tray's box layout.
263 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 264 if (use_md)
264 AddTrayItem(new PaddingTrayItem()); 265 AddTrayItem(new PaddingTrayItem());
265 266
266 if (maximum_user_profiles > 1) { 267 if (!use_md && maximum_user_profiles > 1) {
267 // Add a special double line separator between users and the rest of the 268 // Add a special double line separator between users and the rest of the
268 // menu if more than one user is logged in. 269 // menu if more than one user is logged in.
269 AddTrayItem(new TrayUserSeparator(this)); 270 AddTrayItem(new TrayUserSeparator(this));
270 } 271 }
271 #endif 272 #endif
272 273
273 const bool use_material_design =
274 MaterialDesignController::IsSystemTrayMenuMaterial();
275 tray_accessibility_ = new TrayAccessibility(this); 274 tray_accessibility_ = new TrayAccessibility(this);
276 if (!use_material_design) 275 if (!use_md)
277 tray_date_ = new TrayDate(this); 276 tray_date_ = new TrayDate(this);
278 tray_update_ = new TrayUpdate(this); 277 tray_update_ = new TrayUpdate(this);
279 278
280 #if defined(OS_CHROMEOS) 279 #if defined(OS_CHROMEOS)
281 AddTrayItem(new TraySessionLengthLimit(this)); 280 AddTrayItem(new TraySessionLengthLimit(this));
282 AddTrayItem(new TrayEnterprise(this)); 281 AddTrayItem(new TrayEnterprise(this));
283 AddTrayItem(new TraySupervisedUser(this)); 282 AddTrayItem(new TraySupervisedUser(this));
284 AddTrayItem(new TrayIME(this)); 283 AddTrayItem(new TrayIME(this));
285 AddTrayItem(tray_accessibility_); 284 AddTrayItem(tray_accessibility_);
286 AddTrayItem(new TrayTracing(this)); 285 AddTrayItem(new TrayTracing(this));
(...skipping 12 matching lines...) Expand all
299 tray_audio_ = new TrayAudio(this); 298 tray_audio_ = new TrayAudio(this);
300 AddTrayItem(tray_audio_); 299 AddTrayItem(tray_audio_);
301 AddTrayItem(new TrayBrightness(this)); 300 AddTrayItem(new TrayBrightness(this));
302 AddTrayItem(new TrayCapsLock(this)); 301 AddTrayItem(new TrayCapsLock(this));
303 // TODO(jamescook): Remove this when mus has support for display management 302 // TODO(jamescook): Remove this when mus has support for display management
304 // and we have a DisplayManager equivalent. See http://crbug.com/548429 303 // and we have a DisplayManager equivalent. See http://crbug.com/548429
305 std::unique_ptr<SystemTrayItem> tray_rotation_lock = 304 std::unique_ptr<SystemTrayItem> tray_rotation_lock =
306 delegate->CreateRotationLockTrayItem(this); 305 delegate->CreateRotationLockTrayItem(this);
307 if (tray_rotation_lock) 306 if (tray_rotation_lock)
308 AddTrayItem(tray_rotation_lock.release()); 307 AddTrayItem(tray_rotation_lock.release());
309 if (!use_material_design) 308 if (!use_md)
310 AddTrayItem(new TraySettings(this)); 309 AddTrayItem(new TraySettings(this));
311 AddTrayItem(tray_update_); 310 AddTrayItem(tray_update_);
312 if (use_material_design) { 311 if (use_md) {
313 tray_tiles_ = new TrayTiles(this); 312 tray_tiles_ = new TrayTiles(this);
314 AddTrayItem(tray_tiles_); 313 AddTrayItem(tray_tiles_);
315 tray_system_info_ = new TraySystemInfo(this); 314 tray_system_info_ = new TraySystemInfo(this);
316 AddTrayItem(tray_system_info_); 315 AddTrayItem(tray_system_info_);
317 } else { 316 } else {
318 AddTrayItem(tray_date_); 317 AddTrayItem(tray_date_);
319 } 318 }
320 #elif defined(OS_WIN) 319 #elif defined(OS_WIN)
321 AddTrayItem(tray_accessibility_); 320 AddTrayItem(tray_accessibility_);
322 AddTrayItem(tray_update_); 321 AddTrayItem(tray_update_);
323 if (!use_material_design) 322 if (!use_md)
324 AddTrayItem(tray_date_); 323 AddTrayItem(tray_date_);
325 #endif 324 #endif
326 // Leading padding. 325 // Leading padding.
327 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 326 if (use_md)
328 AddTrayItem(new PaddingTrayItem()); 327 AddTrayItem(new PaddingTrayItem());
329 } 328 }
330 329
331 void SystemTray::AddTrayItem(SystemTrayItem* item) { 330 void SystemTray::AddTrayItem(SystemTrayItem* item) {
332 items_.push_back(item); 331 items_.push_back(item);
333 332
334 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 333 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
335 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus()); 334 views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus());
336 item->UpdateAfterShelfAlignmentChange(shelf_alignment()); 335 item->UpdateAfterShelfAlignmentChange(shelf_alignment());
337 336
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 .work_area() 953 .work_area()
955 .height(); 954 .height();
956 if (work_area_height > 0) { 955 if (work_area_height > 0) {
957 UMA_HISTOGRAM_CUSTOM_COUNTS( 956 UMA_HISTOGRAM_CUSTOM_COUNTS(
958 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 957 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
959 100 * bubble_view->height() / work_area_height, 1, 300, 100); 958 100 * bubble_view->height() / work_area_height, 1, 300, 100);
960 } 959 }
961 } 960 }
962 961
963 } // namespace ash 962 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/tray/tray_popup_utils.cc » ('j') | ash/common/system/user/rounded_image_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698