| 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/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/strings/grit/ash_strings.h" | 8 #include "ash/common/strings/grit/ash_strings.h" |
| 9 #include "ash/common/system/tray/system_tray_controller.h" | 9 #include "ash/common/system/tray/system_tray_controller.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 columns->AddPaddingColumn(0, kVerticalClockLeftPadding); | 354 columns->AddPaddingColumn(0, kVerticalClockLeftPadding); |
| 355 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, | 355 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, |
| 356 0, views::GridLayout::USE_PREF, 0, 0); | 356 0, views::GridLayout::USE_PREF, 0, 0); |
| 357 layout->AddPaddingRow( | 357 layout->AddPaddingRow( |
| 358 0, is_material_design ? kClockLeadingPadding | 358 0, is_material_design ? kClockLeadingPadding |
| 359 : kTrayLabelItemVerticalPaddingVerticalAlignment); | 359 : kTrayLabelItemVerticalPaddingVerticalAlignment); |
| 360 layout->StartRow(0, kColumnId); | 360 layout->StartRow(0, kColumnId); |
| 361 layout->AddView(vertical_label_hours_.get()); | 361 layout->AddView(vertical_label_hours_.get()); |
| 362 layout->StartRow(0, kColumnId); | 362 layout->StartRow(0, kColumnId); |
| 363 layout->AddView(vertical_label_minutes_.get()); | 363 layout->AddView(vertical_label_minutes_.get()); |
| 364 layout->AddPaddingRow(0, | 364 layout->AddPaddingRow( |
| 365 is_material_design | 365 0, |
| 366 ? GetTrayConstant(TRAY_IMAGE_ITEM_PADDING) + | 366 is_material_design |
| 367 kVerticalClockMinutesTopOffsetMD | 367 ? kTrayImageItemPadding + kVerticalClockMinutesTopOffsetMD |
| 368 : kTrayLabelItemVerticalPaddingVerticalAlignment); | 368 : kTrayLabelItemVerticalPaddingVerticalAlignment); |
| 369 } | 369 } |
| 370 Layout(); | 370 Layout(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void TimeView::SetBorderFromLayout(ClockLayout clock_layout) { | 373 void TimeView::SetBorderFromLayout(ClockLayout clock_layout) { |
| 374 if (clock_layout == ClockLayout::HORIZONTAL_CLOCK) { | 374 if (clock_layout == ClockLayout::HORIZONTAL_CLOCK) { |
| 375 SetBorder(views::CreateEmptyBorder(gfx::Insets( | 375 SetBorder(views::CreateEmptyBorder( |
| 376 0, UseMd() ? GetTrayConstant(TRAY_IMAGE_ITEM_PADDING) | 376 gfx::Insets(0, |
| 377 : kTrayLabelItemHorizontalPaddingBottomAlignment))); | 377 UseMd() ? kTrayImageItemPadding |
| 378 : kTrayLabelItemHorizontalPaddingBottomAlignment))); |
| 378 } else { | 379 } else { |
| 379 SetBorder(views::NullBorder()); | 380 SetBorder(views::NullBorder()); |
| 380 } | 381 } |
| 381 } | 382 } |
| 382 | 383 |
| 383 void TimeView::SetupLabels() { | 384 void TimeView::SetupLabels() { |
| 384 horizontal_label_.reset(new views::Label()); | 385 horizontal_label_.reset(new views::Label()); |
| 385 SetupLabel(horizontal_label_.get()); | 386 SetupLabel(horizontal_label_.get()); |
| 386 vertical_label_hours_.reset(new views::Label()); | 387 vertical_label_hours_.reset(new views::Label()); |
| 387 SetupLabel(vertical_label_hours_.get()); | 388 SetupLabel(vertical_label_hours_.get()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 398 } | 399 } |
| 399 | 400 |
| 400 void TimeView::SetupLabel(views::Label* label) { | 401 void TimeView::SetupLabel(views::Label* label) { |
| 401 label->set_owned_by_client(); | 402 label->set_owned_by_client(); |
| 402 SetupLabelForTray(label); | 403 SetupLabelForTray(label); |
| 403 label->SetElideBehavior(gfx::NO_ELIDE); | 404 label->SetElideBehavior(gfx::NO_ELIDE); |
| 404 } | 405 } |
| 405 | 406 |
| 406 } // namespace tray | 407 } // namespace tray |
| 407 } // namespace ash | 408 } // namespace ash |
| OLD | NEW |