scoped_display_for_new_windows.cc 779 B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/display/scoped_display_for_new_windows.h"
  5. #include "ui/display/screen.h"
  6. namespace display {
  7. ScopedDisplayForNewWindows::ScopedDisplayForNewWindows(int64_t new_display) {
  8. Screen::GetScreen()->SetScopedDisplayForNewWindows(new_display);
  9. }
  10. ScopedDisplayForNewWindows::ScopedDisplayForNewWindows(gfx::NativeView view)
  11. : ScopedDisplayForNewWindows(
  12. Screen::GetScreen()->GetDisplayNearestView(view).id()) {}
  13. ScopedDisplayForNewWindows::~ScopedDisplayForNewWindows() {
  14. Screen::GetScreen()->SetScopedDisplayForNewWindows(
  15. display::kInvalidDisplayId);
  16. }
  17. } // namespace display