diff options
Diffstat (limited to 'chromium/ui/base/idle/scoped_set_idle_state.cc')
-rw-r--r-- | chromium/ui/base/idle/scoped_set_idle_state.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chromium/ui/base/idle/scoped_set_idle_state.cc b/chromium/ui/base/idle/scoped_set_idle_state.cc new file mode 100644 index 00000000000..93baa00b0df --- /dev/null +++ b/chromium/ui/base/idle/scoped_set_idle_state.cc @@ -0,0 +1,20 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/idle/scoped_set_idle_state.h" + +#include "ui/base/idle/idle_internal.h" + +namespace ui { + +ScopedSetIdleState::ScopedSetIdleState(IdleState state) + : previous_state_(IdleStateForTesting()) { + IdleStateForTesting() = state; +} + +ScopedSetIdleState::~ScopedSetIdleState() { + IdleStateForTesting() = previous_state_; +} + +} // namespace ui |