Index: ash/common/system/chromeos/brightness/tray_brightness.cc |
diff --git a/ash/common/system/chromeos/brightness/tray_brightness.cc b/ash/common/system/chromeos/brightness/tray_brightness.cc |
index cada6c43bf6566ac3efc0a471dbb39658aeb50c5..1b24202012f17d50ceda45796a2cb13c1c4b009e 100644 |
--- a/ash/common/system/chromeos/brightness/tray_brightness.cc |
+++ b/ash/common/system/chromeos/brightness/tray_brightness.cc |
@@ -47,6 +47,9 @@ const double kMinBrightnessPercent = 5.0; |
} // namespace |
+// TODO(yiyix|tdanderson): Once Chrome OS material design is enabled by default, |
+// BrightnessView does not need to be a ShellObserver to observe touch view mode |
+// changes. See crbug.com/614453. |
tdanderson
2016/09/12 15:54:49
Good catch, and thanks for add this TODO.
yiyix
2016/09/12 17:31:24
:) thanks
|
class BrightnessView : public ShellObserver, |
public views::View, |
public views::SliderListener { |
@@ -123,11 +126,16 @@ BrightnessView::BrightnessView(bool default_view, double initial_percent) |
rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_BRIGHTNESS)); |
AddChildView(slider_); |
- if (is_default_view_) { |
- WmShell::Get()->AddShellObserver(this); |
- SetVisible(WmShell::Get() |
- ->maximize_mode_controller() |
- ->IsMaximizeModeWindowManagerEnabled()); |
+ if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
+ bool show_icon = !icon->GetImage().isNull(); |
tdanderson
2016/09/12 15:54:49
I don't think this check is necessary; you just be
yiyix
2016/09/12 17:31:24
Done.
|
+ SetVisible(show_icon); |
+ } else { |
+ if (is_default_view_) { |
+ WmShell::Get()->AddShellObserver(this); |
+ SetVisible(WmShell::Get() |
+ ->maximize_mode_controller() |
+ ->IsMaximizeModeWindowManagerEnabled()); |
+ } |
} |
} |
@@ -143,11 +151,13 @@ void BrightnessView::SetBrightnessPercent(double percent) { |
} |
void BrightnessView::OnMaximizeModeStarted() { |
- SetVisible(true); |
+ if (!MaterialDesignController::IsSystemTrayMenuMaterial()) |
+ SetVisible(true); |
} |
void BrightnessView::OnMaximizeModeEnded() { |
- SetVisible(false); |
+ if (!MaterialDesignController::IsSystemTrayMenuMaterial()) |
+ SetVisible(false); |
} |
void BrightnessView::OnBoundsChanged(const gfx::Rect& old_bounds) { |