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

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: Staying inside core 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 , m_page(page) 335 , m_page(page)
336 , m_injectedScriptManager(injectedScriptManager) 336 , m_injectedScriptManager(injectedScriptManager)
337 , m_client(client) 337 , m_client(client)
338 , m_frontend(0) 338 , m_frontend(0)
339 , m_overlay(overlay) 339 , m_overlay(overlay)
340 , m_lastScriptIdentifier(0) 340 , m_lastScriptIdentifier(0)
341 , m_enabled(false) 341 , m_enabled(false)
342 , m_ignoreScriptsEnabledNotification(false) 342 , m_ignoreScriptsEnabledNotification(false)
343 , m_deviceMetricsOverridden(false) 343 , m_deviceMetricsOverridden(false)
344 , m_emulateViewportEnabled(false) 344 , m_emulateViewportEnabled(false)
345 , m_embedderDeviceSupportsTouch(false)
345 , m_embedderTextAutosizingEnabled(m_page->settings().textAutosizingEnabled() ) 346 , m_embedderTextAutosizingEnabled(m_page->settings().textAutosizingEnabled() )
346 , m_embedderFontScaleFactor(m_page->settings().deviceScaleAdjustment()) 347 , m_embedderFontScaleFactor(m_page->settings().deviceScaleAdjustment())
347 { 348 {
348 } 349 }
349 350
350 void InspectorPageAgent::setTextAutosizingEnabled(bool enabled) 351 void InspectorPageAgent::setTextAutosizingEnabled(bool enabled)
351 { 352 {
352 m_embedderTextAutosizingEnabled = enabled; 353 m_embedderTextAutosizingEnabled = enabled;
353 if (!m_deviceMetricsOverridden) 354 if (!m_deviceMetricsOverridden)
354 m_page->settings().setTextAutosizingEnabled(enabled); 355 m_page->settings().setTextAutosizingEnabled(enabled);
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 } 1155 }
1155 1156
1156 // FIXME: allow metrics override, fps counter and continuous painting at the same time: crbug.com/299837. 1157 // FIXME: allow metrics override, fps counter and continuous painting at the same time: crbug.com/299837.
1157 m_client->setShowFPSCounter(m_state->getBoolean(PageAgentState::pageAgentSho wFPSCounter) && !m_deviceMetricsOverridden); 1158 m_client->setShowFPSCounter(m_state->getBoolean(PageAgentState::pageAgentSho wFPSCounter) && !m_deviceMetricsOverridden);
1158 m_client->setContinuousPaintingEnabled(m_state->getBoolean(PageAgentState::p ageAgentContinuousPaintingEnabled) && !m_deviceMetricsOverridden); 1159 m_client->setContinuousPaintingEnabled(m_state->getBoolean(PageAgentState::p ageAgentContinuousPaintingEnabled) && !m_deviceMetricsOverridden);
1159 } 1160 }
1160 1161
1161 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled) 1162 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
1162 { 1163 {
1163 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled); 1164 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
1165 if (enabled)
1166 m_embedderDeviceSupportsTouch = m_page->settings().deviceSupportsTouch() ;
1164 m_client->setTouchEventEmulationEnabled(enabled); 1167 m_client->setTouchEventEmulationEnabled(enabled);
1165 } 1168 }
1166 1169
1167 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled) 1170 void InspectorPageAgent::hasTouchInputs(ErrorString*, bool* result)
1171 {
1172 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled))
1173 *result = m_embedderDeviceSupportsTouch;
1174 else
1175 *result = m_page->settings().deviceSupportsTouch();
1176 }
1177
1178 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed)
1168 { 1179 {
1169 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed) 1180 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed)
1170 return; 1181 return;
1182 if (enabled && m_page->settings().deviceSupportsTouch()) {
1183 if (error)
1184 *error = "Device already supports touch input";
1185 return;
1186 }
1171 updateTouchEventEmulationInPage(enabled); 1187 updateTouchEventEmulationInPage(enabled);
1172 } 1188 }
1173 1189
1174 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media) 1190 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
1175 { 1191 {
1176 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia); 1192 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia);
1177 if (media == currentMedia) 1193 if (media == currentMedia)
1178 return; 1194 return;
1179 1195
1180 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); 1196 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 } 1242 }
1227 1243
1228 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1244 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1229 { 1245 {
1230 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1246 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1231 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1247 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1232 } 1248 }
1233 1249
1234 } // namespace WebCore 1250 } // namespace WebCore
1235 1251
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698