metrics_aura.cc 919 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2011 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 "build/build_config.h"
  5. #include "ui/views/metrics.h"
  6. #if BUILDFLAG(IS_WIN)
  7. #include <windows.h>
  8. #endif
  9. namespace views {
  10. int GetDoubleClickInterval() {
  11. #if BUILDFLAG(IS_WIN)
  12. return static_cast<int>(::GetDoubleClickTime());
  13. #else
  14. // TODO(jennyz): This value may need to be adjusted on different platforms.
  15. const int kDefaultDoubleClickIntervalMs = 500;
  16. return kDefaultDoubleClickIntervalMs;
  17. #endif
  18. }
  19. int GetMenuShowDelay() {
  20. #if BUILDFLAG(IS_WIN)
  21. static int delay = []() {
  22. DWORD show_delay;
  23. return SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0)
  24. ? static_cast<int>(show_delay)
  25. : kDefaultMenuShowDelay;
  26. }();
  27. return delay;
  28. #else
  29. return 0;
  30. #endif
  31. }
  32. } // namespace views