Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: ui/base/material_design/material_design_controller.cc

Issue 1844033002: Permit MaterialDesignController to make IO call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: presubmit change Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | ui/events/devices/device_util_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/material_design/material_design_controller.cc
diff --git a/ui/base/material_design/material_design_controller.cc b/ui/base/material_design/material_design_controller.cc
index aee66b27aed524d896f61e4fec5950f9dc2ab85d..86685cf5114f2d0db70683e5828e42960227dfe2 100644
--- a/ui/base/material_design/material_design_controller.cc
+++ b/ui/base/material_design/material_design_controller.cc
@@ -18,6 +18,7 @@
#include <fcntl.h>
#include "base/files/file_enumerator.h"
+#include "base/threading/thread_restrictions.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#endif // defined(USE_OZONE)
@@ -82,6 +83,8 @@ bool MaterialDesignController::IsSecondaryUiMaterial() {
// static
MaterialDesignController::Mode MaterialDesignController::DefaultMode() {
#if defined(OS_CHROMEOS)
+ // If a scan of available devices has already completed, use material-hybrid
+ // if a touchscreen is present.
if (DeviceDataManager::HasInstance() &&
DeviceDataManager::GetInstance()->device_lists_complete()) {
return GetTouchScreensAvailability() == TouchScreensAvailability::ENABLED
@@ -90,6 +93,9 @@ MaterialDesignController::Mode MaterialDesignController::DefaultMode() {
}
#if defined(USE_OZONE)
+ // Otherwise perform our own scan to determine the presence of a touchscreen.
+ // Note this is a one-time call that occurs during device startup or restart.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FileEnumerator file_enum(
base::FilePath(FILE_PATH_LITERAL("/dev/input")), false,
base::FileEnumerator::FILES, FILE_PATH_LITERAL("event*[0-9]"));
« no previous file with comments | « PRESUBMIT.py ('k') | ui/events/devices/device_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698