OLD | NEW |
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/system/chromeos/brightness/tray_brightness.h" | 5 #include "ash/system/chromeos/brightness/tray_brightness.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/ash_constants.h" | 8 #include "ash/ash_constants.h" |
| 9 #include "ash/display/display_manager.h" |
9 #include "ash/metrics/user_metrics_recorder.h" | 10 #include "ash/metrics/user_metrics_recorder.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/system/brightness_control_delegate.h" | 12 #include "ash/system/brightness_control_delegate.h" |
12 #include "ash/system/tray/fixed_sized_image_view.h" | 13 #include "ash/system/tray/fixed_sized_image_view.h" |
13 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
14 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
15 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
16 #include "base/bind.h" | 17 #include "base/bind.h" |
17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 HandleBrightnessChanged(percent, user_initiated); | 213 HandleBrightnessChanged(percent, user_initiated); |
213 } | 214 } |
214 | 215 |
215 void TrayBrightness::HandleBrightnessChanged(double percent, | 216 void TrayBrightness::HandleBrightnessChanged(double percent, |
216 bool user_initiated) { | 217 bool user_initiated) { |
217 current_percent_ = percent; | 218 current_percent_ = percent; |
218 got_current_percent_ = true; | 219 got_current_percent_ = true; |
219 | 220 |
220 if (brightness_view_) | 221 if (brightness_view_) |
221 brightness_view_->SetBrightnessPercent(percent); | 222 brightness_view_->SetBrightnessPercent(percent); |
| 223 |
222 if (!user_initiated) | 224 if (!user_initiated) |
223 return; | 225 return; |
224 | 226 |
| 227 // Never show the bubble on systems that lack internal displays: if an |
| 228 // external display's brightness is changed, it may already display the new |
| 229 // level via an on-screen display. |
| 230 if (!Shell::GetInstance()->display_manager()->HasInternalDisplay()) |
| 231 return; |
| 232 |
225 if (brightness_view_) | 233 if (brightness_view_) |
226 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 234 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
227 else | 235 else |
228 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 236 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
229 } | 237 } |
230 | 238 |
231 } // namespace internal | 239 } // namespace internal |
232 } // namespace ash | 240 } // namespace ash |
OLD | NEW |