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

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

Issue 14296003: Remove TOUCH_EVENTS and TOUCH_EVENT_TRACKING compile-time flags. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static const char pageAgentScriptExecutionDisabled[] = "pageAgentScriptExecution Disabled"; 89 static const char pageAgentScriptExecutionDisabled[] = "pageAgentScriptExecution Disabled";
90 static const char pageAgentScriptsToEvaluateOnLoad[] = "pageAgentScriptsToEvalua teOnLoad"; 90 static const char pageAgentScriptsToEvaluateOnLoad[] = "pageAgentScriptsToEvalua teOnLoad";
91 static const char pageAgentScreenWidthOverride[] = "pageAgentScreenWidthOverride "; 91 static const char pageAgentScreenWidthOverride[] = "pageAgentScreenWidthOverride ";
92 static const char pageAgentScreenHeightOverride[] = "pageAgentScreenHeightOverri de"; 92 static const char pageAgentScreenHeightOverride[] = "pageAgentScreenHeightOverri de";
93 static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactor Override"; 93 static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactor Override";
94 static const char pageAgentFitWindow[] = "pageAgentFitWindow"; 94 static const char pageAgentFitWindow[] = "pageAgentFitWindow";
95 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter"; 95 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
96 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPai ntingEnabled"; 96 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPai ntingEnabled";
97 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects"; 97 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects";
98 static const char pageAgentShowDebugBorders[] = "pageAgentShowDebugBorders"; 98 static const char pageAgentShowDebugBorders[] = "pageAgentShowDebugBorders";
99 #if ENABLE(TOUCH_EVENTS)
100 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; 99 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
101 #endif
102 static const char pageAgentEmulatedMedia[] = "pageAgentEmulatedMedia"; 100 static const char pageAgentEmulatedMedia[] = "pageAgentEmulatedMedia";
103 } 101 }
104 102
105 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEn codingName, String* result) 103 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEn codingName, String* result)
106 { 104 {
107 if (buffer) { 105 if (buffer) {
108 TextEncoding encoding(textEncodingName); 106 TextEncoding encoding(textEncodingName);
109 if (!encoding.isValid()) 107 if (!encoding.isValid())
110 encoding = WindowsLatin1Encoding(); 108 encoding = WindowsLatin1Encoding();
111 *result = encoding.decode(buffer, size); 109 *result = encoding.decode(buffer, size);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 339
342 void InspectorPageAgent::setFrontend(InspectorFrontend* frontend) 340 void InspectorPageAgent::setFrontend(InspectorFrontend* frontend)
343 { 341 {
344 m_frontend = frontend->page(); 342 m_frontend = frontend->page();
345 } 343 }
346 344
347 void InspectorPageAgent::clearFrontend() 345 void InspectorPageAgent::clearFrontend()
348 { 346 {
349 ErrorString error; 347 ErrorString error;
350 disable(&error); 348 disable(&error);
351 #if ENABLE(TOUCH_EVENTS)
352 updateTouchEventEmulationInPage(false); 349 updateTouchEventEmulationInPage(false);
353 #endif
354 m_frontend = 0; 350 m_frontend = 0;
355 } 351 }
356 352
357 void InspectorPageAgent::restore() 353 void InspectorPageAgent::restore()
358 { 354 {
359 if (m_state->getBoolean(PageAgentState::pageAgentEnabled)) { 355 if (m_state->getBoolean(PageAgentState::pageAgentEnabled)) {
360 ErrorString error; 356 ErrorString error;
361 enable(&error); 357 enable(&error);
362 bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageA gentScriptExecutionDisabled); 358 bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageA gentScriptExecutionDisabled);
363 setScriptExecutionDisabled(0, scriptExecutionDisabled); 359 setScriptExecutionDisabled(0, scriptExecutionDisabled);
364 bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowP aintRects); 360 bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowP aintRects);
365 setShowPaintRects(0, showPaintRects); 361 setShowPaintRects(0, showPaintRects);
366 bool showDebugBorders = m_state->getBoolean(PageAgentState::pageAgentSho wDebugBorders); 362 bool showDebugBorders = m_state->getBoolean(PageAgentState::pageAgentSho wDebugBorders);
367 setShowDebugBorders(0, showDebugBorders); 363 setShowDebugBorders(0, showDebugBorders);
368 bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowF PSCounter); 364 bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowF PSCounter);
369 setShowFPSCounter(0, showFPSCounter); 365 setShowFPSCounter(0, showFPSCounter);
370 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmula tedMedia); 366 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmula tedMedia);
371 setEmulatedMedia(0, emulatedMedia); 367 setEmulatedMedia(0, emulatedMedia);
372 bool continuousPaintingEnabled = m_state->getBoolean(PageAgentState::pag eAgentContinuousPaintingEnabled); 368 bool continuousPaintingEnabled = m_state->getBoolean(PageAgentState::pag eAgentContinuousPaintingEnabled);
373 setContinuousPaintingEnabled(0, continuousPaintingEnabled); 369 setContinuousPaintingEnabled(0, continuousPaintingEnabled);
374 370
375 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pag eAgentScreenWidthOverride)); 371 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pag eAgentScreenWidthOverride));
376 int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pa geAgentScreenHeightOverride)); 372 int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pa geAgentScreenHeightOverride));
377 double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageA gentFontScaleFactorOverride); 373 double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageA gentFontScaleFactorOverride);
378 bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFit Window); 374 bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFit Window);
379 updateViewMetrics(currentWidth, currentHeight, currentFontScaleFactor, c urrentFitWindow); 375 updateViewMetrics(currentWidth, currentHeight, currentFontScaleFactor, c urrentFitWindow);
380 #if ENABLE(TOUCH_EVENTS)
381 updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touc hEventEmulationEnabled)); 376 updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touc hEventEmulationEnabled));
382 #endif
383 } 377 }
384 } 378 }
385 379
386 void InspectorPageAgent::webViewResized(const IntSize& size) 380 void InspectorPageAgent::webViewResized(const IntSize& size)
387 { 381 {
388 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAge ntScreenWidthOverride)); 382 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAge ntScreenWidthOverride));
389 m_overlay->resize(currentWidth ? size : IntSize()); 383 m_overlay->resize(currentWidth ? size : IntSize());
390 } 384 }
391 385
392 void InspectorPageAgent::enable(ErrorString*) 386 void InspectorPageAgent::enable(ErrorString*)
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 void InspectorPageAgent::updateViewMetrics(int width, int height, double fontSca leFactor, bool fitWindow) 1079 void InspectorPageAgent::updateViewMetrics(int width, int height, double fontSca leFactor, bool fitWindow)
1086 { 1080 {
1087 m_client->overrideDeviceMetrics(width, height, static_cast<float>(fontScaleF actor), fitWindow); 1081 m_client->overrideDeviceMetrics(width, height, static_cast<float>(fontScaleF actor), fitWindow);
1088 1082
1089 Document* document = mainFrame()->document(); 1083 Document* document = mainFrame()->document();
1090 if (document) 1084 if (document)
1091 document->styleResolverChanged(RecalcStyleImmediately); 1085 document->styleResolverChanged(RecalcStyleImmediately);
1092 InspectorInstrumentation::mediaQueryResultChanged(document); 1086 InspectorInstrumentation::mediaQueryResultChanged(document);
1093 } 1087 }
1094 1088
1095 #if ENABLE(TOUCH_EVENTS)
1096 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled) 1089 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
1097 { 1090 {
1098 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled); 1091 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
1099 if (mainFrame() && mainFrame()->settings()) 1092 if (mainFrame() && mainFrame()->settings())
1100 mainFrame()->settings()->setTouchEventEmulationEnabled(enabled); 1093 mainFrame()->settings()->setTouchEventEmulationEnabled(enabled);
1101 } 1094 }
1102 #endif
1103 1095
1104 void InspectorPageAgent::setGeolocationOverride(ErrorString* error, const double * latitude, const double* longitude, const double* accuracy) 1096 void InspectorPageAgent::setGeolocationOverride(ErrorString* error, const double * latitude, const double* longitude, const double* accuracy)
1105 { 1097 {
1106 GeolocationController* controller = GeolocationController::from(m_page); 1098 GeolocationController* controller = GeolocationController::from(m_page);
1107 GeolocationPosition* position = 0; 1099 GeolocationPosition* position = 0;
1108 if (!controller) { 1100 if (!controller) {
1109 *error = "Internal error: unable to override geolocation"; 1101 *error = "Internal error: unable to override geolocation";
1110 return; 1102 return;
1111 } 1103 }
1112 position = controller->lastPosition(); 1104 position = controller->lastPosition();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1158
1167 DeviceOrientationData* InspectorPageAgent::overrideDeviceOrientation(DeviceOrien tationData* deviceOrientation) 1159 DeviceOrientationData* InspectorPageAgent::overrideDeviceOrientation(DeviceOrien tationData* deviceOrientation)
1168 { 1160 {
1169 if (m_deviceOrientation) 1161 if (m_deviceOrientation)
1170 deviceOrientation = m_deviceOrientation.get(); 1162 deviceOrientation = m_deviceOrientation.get();
1171 return deviceOrientation; 1163 return deviceOrientation;
1172 } 1164 }
1173 1165
1174 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed) 1166 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed)
1175 { 1167 {
1176 #if ENABLE(TOUCH_EVENTS)
1177 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed) 1168 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed)
1178 return; 1169 return;
1179 UNUSED_PARAM(error); 1170 UNUSED_PARAM(error);
1180 updateTouchEventEmulationInPage(enabled); 1171 updateTouchEventEmulationInPage(enabled);
1181 #else
1182 *error = "Touch events emulation not supported";
1183 UNUSED_PARAM(enabled);
1184 #endif
1185 } 1172 }
1186 1173
1187 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media) 1174 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
1188 { 1175 {
1189 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia); 1176 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia);
1190 if (media == currentMedia) 1177 if (media == currentMedia)
1191 return; 1178 return;
1192 1179
1193 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); 1180 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
1194 Document* document = 0; 1181 Document* document = 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // Handled on the browser level. 1220 // Handled on the browser level.
1234 } 1221 }
1235 1222
1236 void InspectorPageAgent::handleJavaScriptDialog(ErrorString* errorString, bool a ccept, const String* promptText) 1223 void InspectorPageAgent::handleJavaScriptDialog(ErrorString* errorString, bool a ccept, const String* promptText)
1237 { 1224 {
1238 // Handled on the browser level. 1225 // Handled on the browser level.
1239 } 1226 }
1240 1227
1241 } // namespace WebCore 1228 } // namespace WebCore
1242 1229
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698