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

Side by Side Diff: ash/common/system/chromeos/screen_security/screen_tray_item.cc

Issue 2638163002: [ash-md] Fixed multi line label layout for system tray cast rows. (Closed)
Patch Set: Removed border from label and added it to the container view. Created 3 years, 11 months 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/screen_security/screen_tray_item.h" 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.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/shelf/wm_shelf_util.h" 8 #include "ash/common/shelf/wm_shelf_util.h"
9 #include "ash/common/system/tray/fixed_sized_image_view.h" 9 #include "ash/common/system/tray/fixed_sized_image_view.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 icon_(nullptr), 51 icon_(nullptr),
52 label_(nullptr), 52 label_(nullptr),
53 stop_button_(nullptr), 53 stop_button_(nullptr),
54 label_text_(label_text), 54 label_text_(label_text),
55 stop_button_text_(stop_button_text) { 55 stop_button_text_(stop_button_text) {
56 CreateItems(); 56 CreateItems();
57 TriView* tri_view(TrayPopupUtils::CreateDefaultRowView()); 57 TriView* tri_view(TrayPopupUtils::CreateDefaultRowView());
58 SetLayoutManager(new views::FillLayout); 58 SetLayoutManager(new views::FillLayout);
59 AddChildView(tri_view); 59 AddChildView(tri_view);
60 tri_view->AddView(TriView::Container::START, icon_); 60 tri_view->AddView(TriView::Container::START, icon_);
61 // TODO(bruthig): Multiline Label's don't lay out well with borders so we add
Jorge Lucangeli Obes 2017/01/18 02:44:43 Nit: "Labels"? This is not a possessive case, is i
bruthig 2017/01/18 15:06:38 Done.
62 // the border to the Label's container instead. See https://crbug.com/678337.
63 tri_view->SetContainerBorder(
64 TriView::Container::CENTER,
65 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding));
61 tri_view->AddView(TriView::Container::CENTER, label_); 66 tri_view->AddView(TriView::Container::CENTER, label_);
62 tri_view->AddView(TriView::Container::END, stop_button_); 67 tri_view->AddView(TriView::Container::END, stop_button_);
63 tri_view->SetContainerBorder( 68 tri_view->SetContainerBorder(
64 TriView::Container::END, 69 TriView::Container::END,
65 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin)); 70 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin));
66 if (screen_tray_item_) 71 if (screen_tray_item_)
67 UpdateFromScreenTrayItem(); 72 UpdateFromScreenTrayItem();
68 } 73 }
69 74
70 ScreenStatusView::~ScreenStatusView() {} 75 ScreenStatusView::~ScreenStatusView() {}
(...skipping 14 matching lines...) Expand all
85 if (!use_md) { 90 if (!use_md) {
86 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 91 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
87 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 92 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
88 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK) 93 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK)
89 .ToImageSkia()); 94 .ToImageSkia());
90 } 95 }
91 96
92 label_ = TrayPopupUtils::CreateDefaultLabel(); 97 label_ = TrayPopupUtils::CreateDefaultLabel();
93 label_->SetMultiLine(true); 98 label_->SetMultiLine(true);
94 label_->SetText(label_text_); 99 label_->SetText(label_text_);
100 // TODO(bruthig): Multiline Label's don't lay out well with borders.
Jorge Lucangeli Obes 2017/01/18 02:44:43 Same.
bruthig 2017/01/18 15:06:38 Done.
101 // See https://crbug.com/678337.
102 label_->SetBorder(nullptr);
95 103
96 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_); 104 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_);
97 } 105 }
98 106
99 void ScreenStatusView::UpdateFromScreenTrayItem() { 107 void ScreenStatusView::UpdateFromScreenTrayItem() {
100 // Hide the notification bubble when the ash tray bubble opens. 108 // Hide the notification bubble when the ash tray bubble opens.
101 screen_tray_item_->HideNotificationView(); 109 screen_tray_item_->HideNotificationView();
102 SetVisible(screen_tray_item_->is_started()); 110 SetVisible(screen_tray_item_->is_started());
103 } 111 }
104 112
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 198
191 void ScreenTrayItem::DestroyTrayView() { 199 void ScreenTrayItem::DestroyTrayView() {
192 tray_view_ = nullptr; 200 tray_view_ = nullptr;
193 } 201 }
194 202
195 void ScreenTrayItem::DestroyDefaultView() { 203 void ScreenTrayItem::DestroyDefaultView() {
196 default_view_ = nullptr; 204 default_view_ = nullptr;
197 } 205 }
198 206
199 } // namespace ash 207 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698