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

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: Fixed/updated some docs. 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 Labels don't lay out well with borders so we add
62 // the border to the Label's container instead. See https://crbug.com/678337 &
63 // https://crbug.com/682221.
64 tri_view->SetContainerBorder(
65 TriView::Container::CENTER,
66 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding));
61 tri_view->AddView(TriView::Container::CENTER, label_); 67 tri_view->AddView(TriView::Container::CENTER, label_);
62 tri_view->AddView(TriView::Container::END, stop_button_); 68 tri_view->AddView(TriView::Container::END, stop_button_);
63 tri_view->SetContainerBorder( 69 tri_view->SetContainerBorder(
64 TriView::Container::END, 70 TriView::Container::END,
65 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin)); 71 views::CreateEmptyBorder(0, 0, 0, kTrayPopupButtonEndMargin));
66 if (screen_tray_item_) 72 if (screen_tray_item_)
67 UpdateFromScreenTrayItem(); 73 UpdateFromScreenTrayItem();
68 } 74 }
69 75
70 ScreenStatusView::~ScreenStatusView() {} 76 ScreenStatusView::~ScreenStatusView() {}
(...skipping 14 matching lines...) Expand all
85 if (!use_md) { 91 if (!use_md) {
86 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 92 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
87 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 93 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
88 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK) 94 icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK)
89 .ToImageSkia()); 95 .ToImageSkia());
90 } 96 }
91 97
92 label_ = TrayPopupUtils::CreateDefaultLabel(); 98 label_ = TrayPopupUtils::CreateDefaultLabel();
93 label_->SetMultiLine(true); 99 label_->SetMultiLine(true);
94 label_->SetText(label_text_); 100 label_->SetText(label_text_);
101 // TODO(bruthig): Multiline Labels don't lay out well with borders.
102 // See https://crbug.com/678337 & https://crbug.com/682221.
103 label_->SetBorder(nullptr);
95 104
96 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_); 105 stop_button_ = TrayPopupUtils::CreateTrayPopupButton(this, stop_button_text_);
97 } 106 }
98 107
99 void ScreenStatusView::UpdateFromScreenTrayItem() { 108 void ScreenStatusView::UpdateFromScreenTrayItem() {
100 // Hide the notification bubble when the ash tray bubble opens. 109 // Hide the notification bubble when the ash tray bubble opens.
101 screen_tray_item_->HideNotificationView(); 110 screen_tray_item_->HideNotificationView();
102 SetVisible(screen_tray_item_->is_started()); 111 SetVisible(screen_tray_item_->is_started());
103 } 112 }
104 113
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 199
191 void ScreenTrayItem::DestroyTrayView() { 200 void ScreenTrayItem::DestroyTrayView() {
192 tray_view_ = nullptr; 201 tray_view_ = nullptr;
193 } 202 }
194 203
195 void ScreenTrayItem::DestroyDefaultView() { 204 void ScreenTrayItem::DestroyDefaultView() {
196 default_view_ = nullptr; 205 default_view_ = nullptr;
197 } 206 }
198 207
199 } // namespace ash 208 } // 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