network_row_title_view.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/system/network/network_row_title_view.h"
  5. #include <string>
  6. #include "ash/style/ash_color_provider.h"
  7. #include "ash/system/tray/tray_popup_utils.h"
  8. #include "ui/base/l10n/l10n_util.h"
  9. #include "ui/gfx/font.h"
  10. #include "ui/gfx/font_list.h"
  11. #include "ui/views/layout/box_layout.h"
  12. namespace ash {
  13. namespace {
  14. const int kLineHeight = 20;
  15. } // namespace
  16. NetworkRowTitleView::NetworkRowTitleView(int title_message_id)
  17. : title_(TrayPopupUtils::CreateDefaultLabel()) {
  18. SetLayoutManager(std::make_unique<views::BoxLayout>(
  19. views::BoxLayout::Orientation::kVertical));
  20. title_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
  21. AshColorProvider::ContentLayerType::kTextColorPrimary));
  22. TrayPopupUtils::SetLabelFontList(title_,
  23. TrayPopupUtils::FontStyle::kSubHeader);
  24. title_->SetLineHeight(kLineHeight);
  25. title_->SetText(l10n_util::GetStringUTF16(title_message_id));
  26. AddChildView(title_);
  27. }
  28. NetworkRowTitleView::~NetworkRowTitleView() = default;
  29. const char* NetworkRowTitleView::GetClassName() const {
  30. return "NetworkRowTitleView";
  31. }
  32. } // namespace ash