| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/power_button_controller.h" | 5 #include "ash/wm/power_button_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/system/chromeos/audio/tray_audio.h" | 10 #include "ash/common/system/chromeos/audio/tray_audio.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 volume_percent_before_screenshot_(0), | 32 volume_percent_before_screenshot_(0), |
| 33 brightness_is_zero_(false), | 33 brightness_is_zero_(false), |
| 34 internal_display_off_and_external_display_on_(false), | 34 internal_display_off_and_external_display_on_(false), |
| 35 has_legacy_power_button_( | 35 has_legacy_power_button_( |
| 36 base::CommandLine::ForCurrentProcess()->HasSwitch( | 36 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 37 switches::kAuraLegacyPowerButton)), | 37 switches::kAuraLegacyPowerButton)), |
| 38 lock_state_controller_(controller) { | 38 lock_state_controller_(controller) { |
| 39 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 39 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 40 this); | 40 this); |
| 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 42 switches::kAshEnableTouchView) || | 42 switches::kAshEnableTouchView)) { |
| 43 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 44 switches::kAshEnableTouchViewTesting)) { | |
| 45 tablet_controller_.reset( | 43 tablet_controller_.reset( |
| 46 new TabletPowerButtonController(lock_state_controller_)); | 44 new TabletPowerButtonController(lock_state_controller_)); |
| 47 } | 45 } |
| 48 Shell::GetInstance()->display_configurator()->AddObserver(this); | 46 Shell::GetInstance()->display_configurator()->AddObserver(this); |
| 49 Shell::GetInstance()->PrependPreTargetHandler(this); | 47 Shell::GetInstance()->PrependPreTargetHandler(this); |
| 50 } | 48 } |
| 51 | 49 |
| 52 PowerButtonController::~PowerButtonController() { | 50 PowerButtonController::~PowerButtonController() { |
| 53 Shell::GetInstance()->RemovePreTargetHandler(this); | 51 Shell::GetInstance()->RemovePreTargetHandler(this); |
| 54 Shell::GetInstance()->display_configurator()->RemoveObserver(this); | 52 Shell::GetInstance()->display_configurator()->RemoveObserver(this); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 internal_display_off && external_display_on; | 191 internal_display_off && external_display_on; |
| 194 } | 192 } |
| 195 | 193 |
| 196 void PowerButtonController::PowerButtonEventReceived( | 194 void PowerButtonController::PowerButtonEventReceived( |
| 197 bool down, | 195 bool down, |
| 198 const base::TimeTicks& timestamp) { | 196 const base::TimeTicks& timestamp) { |
| 199 OnPowerButtonEvent(down, timestamp); | 197 OnPowerButtonEvent(down, timestamp); |
| 200 } | 198 } |
| 201 | 199 |
| 202 } // namespace ash | 200 } // namespace ash |
| OLD | NEW |