Chromium Code Reviews| 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 <algorithm> | |
| 8 | |
|
jonross
2014/05/29 15:24:42
cpplint
| |
| 7 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| 9 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
| 10 #include "ash/metrics/user_metrics_recorder.h" | 12 #include "ash/metrics/user_metrics_recorder.h" |
| 11 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 12 #include "ash/shell_observer.h" | 14 #include "ash/shell_observer.h" |
| 13 #include "ash/system/brightness_control_delegate.h" | 15 #include "ash/system/brightness_control_delegate.h" |
| 14 #include "ash/system/tray/fixed_sized_image_view.h" | 16 #include "ash/system/tray/fixed_sized_image_view.h" |
| 15 #include "ash/system/tray/system_tray_delegate.h" | 17 #include "ash/system/tray/system_tray_delegate.h" |
| 16 #include "ash/system/tray/system_tray_notifier.h" | 18 #include "ash/system/tray/system_tray_notifier.h" |
| 17 #include "ash/system/tray/tray_constants.h" | 19 #include "ash/system/tray/tray_constants.h" |
| 20 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 18 #include "base/bind.h" | 21 #include "base/bind.h" |
| 19 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chromeos/dbus/dbus_thread_manager.h" | 24 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/dbus/power_manager_client.h" | 25 #include "chromeos/dbus/power_manager_client.h" |
| 23 #include "grit/ash_resources.h" | 26 #include "grit/ash_resources.h" |
| 24 #include "grit/ash_strings.h" | 27 #include "grit/ash_strings.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
| 27 #include "ui/views/controls/button/image_button.h" | 30 #include "ui/views/controls/button/image_button.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 slider_ = new views::Slider(this, views::Slider::HORIZONTAL); | 109 slider_ = new views::Slider(this, views::Slider::HORIZONTAL); |
| 107 slider_->set_focus_border_color(kFocusBorderColor); | 110 slider_->set_focus_border_color(kFocusBorderColor); |
| 108 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); | 111 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); |
| 109 slider_->SetAccessibleName( | 112 slider_->SetAccessibleName( |
| 110 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 113 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 111 IDS_ASH_STATUS_TRAY_BRIGHTNESS)); | 114 IDS_ASH_STATUS_TRAY_BRIGHTNESS)); |
| 112 AddChildView(slider_); | 115 AddChildView(slider_); |
| 113 | 116 |
| 114 if (is_default_view_) { | 117 if (is_default_view_) { |
| 115 Shell::GetInstance()->AddShellObserver(this); | 118 Shell::GetInstance()->AddShellObserver(this); |
| 116 SetVisible(Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled()); | 119 SetVisible(Shell::GetInstance()->maximize_mode_controller()-> |
| 120 IsMaximizeModeWindowManagerEnabled()); | |
|
flackr
2014/05/29 16:10:06
nit: indent 4 more to show it's wrapped from above
jonross
2014/05/29 17:40:00
Done.
| |
| 117 } | 121 } |
| 118 } | 122 } |
| 119 | 123 |
| 120 BrightnessView::~BrightnessView() { | 124 BrightnessView::~BrightnessView() { |
| 121 if (is_default_view_) | 125 if (is_default_view_) |
| 122 Shell::GetInstance()->RemoveShellObserver(this); | 126 Shell::GetInstance()->RemoveShellObserver(this); |
| 123 } | 127 } |
| 124 | 128 |
| 125 void BrightnessView::SetBrightnessPercent(double percent) { | 129 void BrightnessView::SetBrightnessPercent(double percent) { |
| 126 last_percent_ = percent; | 130 last_percent_ = percent; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 if (!Shell::GetInstance()->display_manager()->HasInternalDisplay()) | 276 if (!Shell::GetInstance()->display_manager()->HasInternalDisplay()) |
| 273 return; | 277 return; |
| 274 | 278 |
| 275 if (brightness_view_) | 279 if (brightness_view_) |
| 276 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 280 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
| 277 else | 281 else |
| 278 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 282 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
| 279 } | 283 } |
| 280 | 284 |
| 281 } // namespace ash | 285 } // namespace ash |
| OLD | NEW |