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

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

Issue 146683003: Settings should not call into inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } 775 }
776 776
777 void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandl er::Result::Enum* status) 777 void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandl er::Result::Enum* status)
778 { 778 {
779 bool disabledByScriptController = false; 779 bool disabledByScriptController = false;
780 bool disabledInSettings = false; 780 bool disabledInSettings = false;
781 Frame* frame = mainFrame(); 781 Frame* frame = mainFrame();
782 if (frame) { 782 if (frame) {
783 disabledByScriptController = !frame->script().canExecuteScripts(NotAbout ToExecuteScript); 783 disabledByScriptController = !frame->script().canExecuteScripts(NotAbout ToExecuteScript);
784 if (frame->settings()) 784 if (frame->settings())
785 disabledInSettings = !frame->settings()->isScriptEnabled(); 785 disabledInSettings = !frame->settings()->scriptEnabled();
786 } 786 }
787 787
788 if (!disabledByScriptController) { 788 if (!disabledByScriptController) {
789 *status = PageCommandHandler::Result::Allowed; 789 *status = PageCommandHandler::Result::Allowed;
790 return; 790 return;
791 } 791 }
792 792
793 if (disabledInSettings) 793 if (disabledInSettings)
794 *status = PageCommandHandler::Result::Disabled; 794 *status = PageCommandHandler::Result::Disabled;
795 else 795 else
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 } 1052 }
1053 1053
1054 void InspectorPageAgent::scriptsEnabled(bool isEnabled) 1054 void InspectorPageAgent::scriptsEnabled(bool isEnabled)
1055 { 1055 {
1056 if (m_ignoreScriptsEnabledNotification) 1056 if (m_ignoreScriptsEnabledNotification)
1057 return; 1057 return;
1058 1058
1059 m_frontend->scriptsEnabled(isEnabled); 1059 m_frontend->scriptsEnabled(isEnabled);
1060 } 1060 }
1061 1061
1062 void InspectorPageAgent::textAutosizingEnabled(bool isEnabled)
1063 {
1064 if (!m_deviceMetricsOverridden)
1065 m_settingsCacheTextAutosizingEnabled = isEnabled;
1066 }
1067
1068 void InspectorPageAgent::fontScaleFactor(float factor)
1069 {
1070 if (!m_deviceMetricsOverridden)
1071 m_settingsCacheFontScaleFactor = factor;
1072 }
1073
1062 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Fra me* frame) 1074 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Fra me* frame)
1063 { 1075 {
1064 RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::cre ate() 1076 RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::cre ate()
1065 .setId(frameId(frame)) 1077 .setId(frameId(frame))
1066 .setLoaderId(loaderId(frame->loader().documentLoader())) 1078 .setLoaderId(loaderId(frame->loader().documentLoader()))
1067 .setUrl(urlWithoutFragment(frame->document()->url()).string()) 1079 .setUrl(urlWithoutFragment(frame->document()->url()).string())
1068 .setMimeType(frame->loader().documentLoader()->responseMIMEType()) 1080 .setMimeType(frame->loader().documentLoader()->responseMIMEType())
1069 .setSecurityOrigin(frame->document()->securityOrigin()->toRawString()); 1081 .setSecurityOrigin(frame->document()->securityOrigin()->toRawString());
1070 if (frame->tree().parent()) 1082 if (frame->tree().parent())
1071 frameObject->setParentId(frameId(frame->tree().parent())); 1083 frameObject->setParentId(frameId(frame->tree().parent()));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1134 }
1123 return result; 1135 return result;
1124 } 1136 }
1125 1137
1126 void InspectorPageAgent::updateViewMetrics(int width, int height, double deviceS caleFactor, bool emulateViewport, bool fitWindow) 1138 void InspectorPageAgent::updateViewMetrics(int width, int height, double deviceS caleFactor, bool emulateViewport, bool fitWindow)
1127 { 1139 {
1128 if (width && height && !m_page->settings().acceleratedCompositingEnabled()) 1140 if (width && height && !m_page->settings().acceleratedCompositingEnabled())
1129 return; 1141 return;
1130 1142
1131 m_deviceMetricsOverridden = width && height; 1143 m_deviceMetricsOverridden = width && height;
1144 Settings& settings = m_page->settings();
1145 if (m_deviceMetricsOverridden) {
1146 settings.setTextAutosizingEnabled(overrideTextAutosizing());
1147 settings.setDeviceScaleAdjustment(overrideFontScaleFactor());
1148 } else {
1149 settings.setTextAutosizingEnabled(m_settingsCacheTextAutosizingEnabled);
1150 settings.setDeviceScaleAdjustment(m_settingsCacheFontScaleFactor);
1151 }
1152
1132 m_emulateViewportEnabled = emulateViewport; 1153 m_emulateViewportEnabled = emulateViewport;
1133 m_client->overrideDeviceMetrics(width, height, static_cast<float>(deviceScal eFactor), emulateViewport, fitWindow); 1154 m_client->overrideDeviceMetrics(width, height, static_cast<float>(deviceScal eFactor), emulateViewport, fitWindow);
1134 1155
1135 Document* document = mainFrame()->document(); 1156 Document* document = mainFrame()->document();
1136 if (document) { 1157 if (document) {
1137 document->styleResolverChanged(RecalcStyleImmediately); 1158 document->styleResolverChanged(RecalcStyleImmediately);
1138 document->mediaQueryAffectingValueChanged(); 1159 document->mediaQueryAffectingValueChanged();
1139 } 1160 }
1140 InspectorInstrumentation::mediaQueryResultChanged(document); 1161 InspectorInstrumentation::mediaQueryResultChanged(document);
1141 1162
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1224 }
1204 1225
1205 controller->didChangeDeviceOrientation(DeviceOrientationData::create(true, a lpha, true, beta, true, gamma).get()); 1226 controller->didChangeDeviceOrientation(DeviceOrientationData::create(true, a lpha, true, beta, true, gamma).get());
1206 } 1227 }
1207 1228
1208 void InspectorPageAgent::clearDeviceOrientationOverride(ErrorString* error) 1229 void InspectorPageAgent::clearDeviceOrientationOverride(ErrorString* error)
1209 { 1230 {
1210 setDeviceOrientationOverride(error, 0, 0, 0); 1231 setDeviceOrientationOverride(error, 0, 0, 0);
1211 } 1232 }
1212 1233
1213 bool InspectorPageAgent::overrideTextAutosizing(bool textAutosizing) 1234 bool InspectorPageAgent::overrideTextAutosizing()
1214 { 1235 {
1215 if (!m_deviceMetricsOverridden)
1216 return textAutosizing;
1217 return m_state->getBoolean(PageAgentState::pageAgentTextAutosizingOverride); 1236 return m_state->getBoolean(PageAgentState::pageAgentTextAutosizingOverride);
1218 } 1237 }
1219 1238
1220 float InspectorPageAgent::overrideFontScaleFactor(float fontScaleFactor) 1239 float InspectorPageAgent::overrideFontScaleFactor()
1221 { 1240 {
1222 if (!m_deviceMetricsOverridden)
1223 return fontScaleFactor;
1224 return static_cast<float>(m_state->getDouble(PageAgentState::fontScaleFactor )); 1241 return static_cast<float>(m_state->getDouble(PageAgentState::fontScaleFactor ));
1225 } 1242 }
1226 1243
1227 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled) 1244 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled)
1228 { 1245 {
1229 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed) 1246 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed)
1230 return; 1247 return;
1231 updateTouchEventEmulationInPage(enabled); 1248 updateTouchEventEmulationInPage(enabled);
1232 } 1249 }
1233 1250
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 } 1333 }
1317 1334
1318 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1335 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1319 { 1336 {
1320 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1337 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1321 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1338 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1322 } 1339 }
1323 1340
1324 } // namespace WebCore 1341 } // namespace WebCore
1325 1342
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698