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

Side by Side Diff: ash/common/system/date/date_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge 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/date/date_view.h" 5 #include "ash/common/system/date/date_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/system_tray_controller.h" 8 #include "ash/common/system/tray/system_tray_controller.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_popup_item_style.h" 10 #include "ash/common/system/tray/tray_popup_item_style.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 : kTrayLabelItemVerticalPaddingVerticalAlignment); 365 : kTrayLabelItemVerticalPaddingVerticalAlignment);
366 } 366 }
367 Layout(); 367 Layout();
368 } 368 }
369 369
370 void TimeView::SetBorderFromLayout(ClockLayout clock_layout) { 370 void TimeView::SetBorderFromLayout(ClockLayout clock_layout) {
371 if (MaterialDesignController::IsShelfMaterial()) 371 if (MaterialDesignController::IsShelfMaterial())
372 return; 372 return;
373 373
374 if (clock_layout == ClockLayout::HORIZONTAL_CLOCK) { 374 if (clock_layout == ClockLayout::HORIZONTAL_CLOCK) {
375 SetBorder(views::Border::CreateEmptyBorder( 375 SetBorder(views::CreateEmptyBorder(
376 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0, 376 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0,
377 kTrayLabelItemHorizontalPaddingBottomAlignment)); 377 kTrayLabelItemHorizontalPaddingBottomAlignment));
378 } else { 378 } else {
379 SetBorder(views::Border::NullBorder()); 379 SetBorder(views::NullBorder());
380 } 380 }
381 } 381 }
382 382
383 void TimeView::SetupLabels() { 383 void TimeView::SetupLabels() {
384 horizontal_label_.reset(new views::Label()); 384 horizontal_label_.reset(new views::Label());
385 SetupLabel(horizontal_label_.get()); 385 SetupLabel(horizontal_label_.get());
386 vertical_label_hours_.reset(new views::Label()); 386 vertical_label_hours_.reset(new views::Label());
387 SetupLabel(vertical_label_hours_.get()); 387 SetupLabel(vertical_label_hours_.get());
388 vertical_label_minutes_.reset(new views::Label()); 388 vertical_label_minutes_.reset(new views::Label());
389 SetupLabel(vertical_label_minutes_.get()); 389 SetupLabel(vertical_label_minutes_.get());
390 // TODO(estade): this should use the NativeTheme's secondary text color. 390 // TODO(estade): this should use the NativeTheme's secondary text color.
391 vertical_label_minutes_->SetEnabledColor(kVerticalClockMinuteColor); 391 vertical_label_minutes_->SetEnabledColor(kVerticalClockMinuteColor);
392 // Pull the minutes up closer to the hours by using a negative top border. 392 // Pull the minutes up closer to the hours by using a negative top border.
393 vertical_label_minutes_->SetBorder(views::Border::CreateEmptyBorder( 393 vertical_label_minutes_->SetBorder(
394 MaterialDesignController::IsShelfMaterial() 394 views::CreateEmptyBorder(MaterialDesignController::IsShelfMaterial()
395 ? kVerticalClockMinutesTopOffsetMD 395 ? kVerticalClockMinutesTopOffsetMD
396 : kVerticalClockMinutesTopOffset, 396 : kVerticalClockMinutesTopOffset,
397 0, 0, 0)); 397 0, 0, 0));
398 } 398 }
399 399
400 void TimeView::SetupLabel(views::Label* label) { 400 void TimeView::SetupLabel(views::Label* label) {
401 label->set_owned_by_client(); 401 label->set_owned_by_client();
402 SetupLabelForTray(label); 402 SetupLabelForTray(label);
403 label->SetElideBehavior(gfx::NO_ELIDE); 403 label->SetElideBehavior(gfx::NO_ELIDE);
404 } 404 }
405 405
406 } // namespace tray 406 } // namespace tray
407 } // namespace ash 407 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/date/date_default_view.cc ('k') | ash/common/system/overview/overview_button_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698