| 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/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 brightness_is_zero_(false), | 38 brightness_is_zero_(false), |
| 39 internal_display_off_and_external_display_on_(false), | 39 internal_display_off_and_external_display_on_(false), |
| 40 has_legacy_power_button_( | 40 has_legacy_power_button_( |
| 41 base::CommandLine::ForCurrentProcess()->HasSwitch( | 41 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 42 switches::kAuraLegacyPowerButton)), | 42 switches::kAuraLegacyPowerButton)), |
| 43 lock_state_controller_(controller) { | 43 lock_state_controller_(controller) { |
| 44 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 45 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 46 this); | 46 this); |
| 47 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 47 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 48 switches::kAshEnableTabletPowerButton)) { | 48 switches::kAshEnableTouchView) || |
| 49 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 50 switches::kAshEnableTouchViewTesting)) { |
| 49 tablet_controller_.reset( | 51 tablet_controller_.reset( |
| 50 new TabletPowerButtonController(lock_state_controller_)); | 52 new TabletPowerButtonController(lock_state_controller_)); |
| 51 } | 53 } |
| 52 Shell::GetInstance()->display_configurator()->AddObserver(this); | 54 Shell::GetInstance()->display_configurator()->AddObserver(this); |
| 53 #endif | 55 #endif |
| 54 Shell::GetInstance()->PrependPreTargetHandler(this); | 56 Shell::GetInstance()->PrependPreTargetHandler(this); |
| 55 } | 57 } |
| 56 | 58 |
| 57 PowerButtonController::~PowerButtonController() { | 59 PowerButtonController::~PowerButtonController() { |
| 58 Shell::GetInstance()->RemovePreTargetHandler(this); | 60 Shell::GetInstance()->RemovePreTargetHandler(this); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 210 } |
| 209 | 211 |
| 210 void PowerButtonController::PowerButtonEventReceived( | 212 void PowerButtonController::PowerButtonEventReceived( |
| 211 bool down, | 213 bool down, |
| 212 const base::TimeTicks& timestamp) { | 214 const base::TimeTicks& timestamp) { |
| 213 OnPowerButtonEvent(down, timestamp); | 215 OnPowerButtonEvent(down, timestamp); |
| 214 } | 216 } |
| 215 #endif // defined(OS_CHROMEOS) | 217 #endif // defined(OS_CHROMEOS) |
| 216 | 218 |
| 217 } // namespace ash | 219 } // namespace ash |
| OLD | NEW |