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

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

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