diff options
author | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-31 01:19:36 +0000 |
---|---|---|
committer | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-31 01:19:36 +0000 |
commit | 4df6ddf95d22711bac03da27816a31b25dcc1043 (patch) | |
tree | b6f46d42bb96dc96733e6b9b154d89b346f38fc4 | |
parent | 2df84ddd3970826127a180199167d9def5dcaf2b (diff) | |
download | chromium_src-4df6ddf95d22711bac03da27816a31b25dcc1043.zip chromium_src-4df6ddf95d22711bac03da27816a31b25dcc1043.tar.gz chromium_src-4df6ddf95d22711bac03da27816a31b25dcc1043.tar.bz2 |
Polish for audio device selector in ash system tray.
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
-rw-r--r-- | ash/ash_strings.grd | 4 | ||||
-rw-r--r-- | ash/system/chromeos/audio/tray_audio.cc | 39 | ||||
-rw-r--r-- | ash/system/tray/hover_highlight_view.cc | 8 | ||||
-rw-r--r-- | ash/system/tray/tray_constants.cc | 1 | ||||
-rw-r--r-- | ash/system/tray/tray_constants.h | 1 |
5 files changed, 38 insertions, 15 deletions
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index a0bafae..75559f4 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd @@ -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."> diff --git a/ash/system/chromeos/audio/tray_audio.cc b/ash/system/chromeos/audio/tray_audio.cc index f25233a..da83aee 100644 --- a/ash/system/chromeos/audio/tray_audio.cc +++ b/ash/system/chromeos/audio/tray_audio.cc @@ -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]), @@ -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]), @@ -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) { @@ -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() { diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc index 3a511a2..a622dc9 100644 --- a/ash/system/tray/hover_highlight_view.cc +++ b/ash/system/tray/hover_highlight_view.cc @@ -17,7 +17,6 @@ namespace { -const int kPopupDetailLabelExtraLeftMargin = 8; const int kCheckLabelPadding = 4; } // namespace @@ -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()) @@ -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); diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc index 6d4b2e6..5ce1f0e 100644 --- a/ash/system/tray/tray_constants.cc +++ b/ash/system/tray/tray_constants.cc @@ -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; diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h index 50b2210..1645f73 100644 --- a/ash/system/tray/tray_constants.h +++ b/ash/system/tray/tray_constants.h @@ -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; |