Skip to content

Commit

Permalink
Polish for audio device selector in ash system tray.
Browse files Browse the repository at this point in the history
Fix shelf hiding when opening device selector: shelf should not auto-hide while
menu is open.
"Input" and "Output" heading labels should not become highlighted on mouseover.
Change "Input" and "Output" labels to title case.

BUG=273115
TEST=manual: enable auto-hide shelf, open tray and open audio details view. Verify that shelf stays open, "Input"/"Output" labels are no longer all caps and do not change background color on mouse hover/click.

Review URL: https://chromiumcodereview.appspot.com/23481009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220712 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
michaelpg@chromium.org committed Aug 31, 2013
1 parent 2df84dd commit 4df6ddf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ash/ash_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ Press Ctrl+Alt+Z to disable.
Audio Settings
</message>
<message name="IDS_ASH_STATUS_TRAY_AUDIO_OUTPUT" desc="The label used in audio detailed page for audio output section of ash tray pop up.">
OUTPUT
Output
</message>
<message name="IDS_ASH_STATUS_TRAY_AUDIO_INPUT" desc="The label used in audio detailed page for audio input section of ash tray pop up.">
INPUT
Input
</message>

<message name="IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING" desc="The label used in the tray to show that the current status is mirroring.">
Expand Down
39 changes: 30 additions & 9 deletions ash/system/chromeos/audio/tray_audio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,8 @@ class AudioDetailedView : public TrayDetailsView,
device_map_.clear();

// Add audio output devices.
AddScrollListItem(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO_OUTPUT),
gfx::Font::BOLD,
false); /* no checkmark */
AddScrollListInfoItem(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO_OUTPUT));
for (size_t i = 0; i < output_devices_.size(); ++i) {
HoverHighlightView* container = AddScrollListItem(
GetAudioDeviceName(output_devices_[i]),
Expand All @@ -469,10 +467,8 @@ class AudioDetailedView : public TrayDetailsView,
AddScrollSeparator();

// Add audio input devices.
AddScrollListItem(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO_INPUT),
gfx::Font::BOLD,
false); /* no checkmark */
AddScrollListInfoItem(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO_INPUT));
for (size_t i = 0; i < input_devices_.size(); ++i) {
HoverHighlightView* container = AddScrollListItem(
GetAudioDeviceName(input_devices_[i]),
Expand All @@ -485,6 +481,31 @@ class AudioDetailedView : public TrayDetailsView,
scroller()->Layout();
}

void AddScrollListInfoItem(const string16& text) {
views::Label* label = new views::Label(text);

// Align info item with checkbox items
int margin = kTrayPopupPaddingHorizontal +
kTrayPopupDetailsLabelExtraLeftMargin;
int left_margin = 0;
int right_margin = 0;
if (base::i18n::IsRTL())
right_margin = margin;
else
left_margin = margin;

label->set_border(views::Border::CreateEmptyBorder(
ash::kTrayPopupPaddingBetweenItems,
left_margin,
ash::kTrayPopupPaddingBetweenItems,
right_margin));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0));
label->SetFont(label->font().DeriveFont(0, gfx::Font::BOLD));

scroll_content()->AddChildView(label);
}

HoverHighlightView* AddScrollListItem(const string16& text,
gfx::Font::FontStyle style,
bool checked) {
Expand Down Expand Up @@ -569,7 +590,7 @@ bool TrayAudio::ShouldHideArrow() const {
}

bool TrayAudio::ShouldShowLauncher() const {
return false;
return ash::switches::ShowAudioDeviceMenu() && !pop_up_volume_view_;
}

void TrayAudio::OnOutputVolumeChanged() {
Expand Down
8 changes: 4 additions & 4 deletions ash/system/tray/hover_highlight_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace {

const int kPopupDetailLabelExtraLeftMargin = 8;
const int kCheckLabelPadding = 4;

} // namespace
Expand Down Expand Up @@ -64,7 +63,8 @@ views::Label* HoverHighlightView::AddLabel(const base::string16& text,
gfx::Font::FontStyle style) {
SetLayoutManager(new views::FillLayout());
text_label_ = new views::Label(text);
int margin = kTrayPopupPaddingHorizontal + kPopupDetailLabelExtraLeftMargin;
int margin = kTrayPopupPaddingHorizontal +
kTrayPopupDetailsLabelExtraLeftMargin;
int left_margin = 0;
int right_margin = 0;
if (base::i18n::IsRTL())
Expand Down Expand Up @@ -93,8 +93,8 @@ views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text,
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::ImageSkia* check =
rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia();
int margin = kTrayPopupPaddingHorizontal + kPopupDetailLabelExtraLeftMargin
- kCheckLabelPadding;
int margin = kTrayPopupPaddingHorizontal +
kTrayPopupDetailsLabelExtraLeftMargin - kCheckLabelPadding;
SetLayoutManager(new views::BoxLayout(
views::BoxLayout::kHorizontal, 0, 3, kCheckLabelPadding));
views::ImageView* image_view = new FixedSizedImageView(margin, 0);
Expand Down
1 change: 1 addition & 0 deletions ash/system/tray/tray_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const int kTrayPopupTextSpacingVertical = 4;

const int kTrayPopupItemHeight = 48;
const int kTrayPopupDetailsIconWidth = 25;
const int kTrayPopupDetailsLabelExtraLeftMargin = 8;
const int kTrayPopupScrollSeparatorHeight = 15;
const int kTrayRoundedBorderRadius = 2;
const int kTrayBarButtonWidth = 39;
Expand Down
1 change: 1 addition & 0 deletions ash/system/tray/tray_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern const int kTrayPopupTextSpacingVertical;

extern const int kTrayPopupItemHeight;
extern const int kTrayPopupDetailsIconWidth;
extern const int kTrayPopupDetailsLabelExtraLeftMargin;
extern const int kTrayPopupScrollSeparatorHeight;
extern const int kTrayRoundedBorderRadius;
extern const int kTrayBarButtonWidth;
Expand Down

0 comments on commit 4df6ddf

Please sign in to comment.