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

Side by Side Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 243233002: [DevTools] Disable touch emulation on devices with touch input. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 m_client->setShowFPSCounter(m_state->getBoolean(PageAgentState::pageAgentSho wFPSCounter) && !m_deviceMetricsOverridden); 1157 m_client->setShowFPSCounter(m_state->getBoolean(PageAgentState::pageAgentSho wFPSCounter) && !m_deviceMetricsOverridden);
1158 m_client->setContinuousPaintingEnabled(m_state->getBoolean(PageAgentState::p ageAgentContinuousPaintingEnabled) && !m_deviceMetricsOverridden); 1158 m_client->setContinuousPaintingEnabled(m_state->getBoolean(PageAgentState::p ageAgentContinuousPaintingEnabled) && !m_deviceMetricsOverridden);
1159 } 1159 }
1160 1160
1161 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled) 1161 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
1162 { 1162 {
1163 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled); 1163 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
1164 m_client->setTouchEventEmulationEnabled(enabled); 1164 m_client->setTouchEventEmulationEnabled(enabled);
1165 } 1165 }
1166 1166
1167 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled) 1167 void InspectorPageAgent::hasTouchInputs(ErrorString*, bool* result)
1168 {
1169 *result = m_client->hasTouchInputs();
1170 }
1171
1172 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed)
1168 { 1173 {
1169 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed) 1174 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed)
1170 return; 1175 return;
1176 if (enabled && m_client->hasTouchInputs()) {
1177 if (error)
1178 *error = "Device already supports touch input";
1179 return;
1180 }
1171 updateTouchEventEmulationInPage(enabled); 1181 updateTouchEventEmulationInPage(enabled);
1172 } 1182 }
1173 1183
1174 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media) 1184 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
1175 { 1185 {
1176 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia); 1186 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia);
1177 if (media == currentMedia) 1187 if (media == currentMedia)
1178 return; 1188 return;
1179 1189
1180 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); 1190 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 } 1236 }
1227 1237
1228 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1238 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1229 { 1239 {
1230 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1240 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1231 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1241 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1232 } 1242 }
1233 1243
1234 } // namespace WebCore 1244 } // namespace WebCore
1235 1245
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698