OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } else if (canAttachWindow()) { | 159 } else if (canAttachWindow()) { |
160 attachWindow(); | 160 attachWindow(); |
161 setAttachedWindow(true); | 161 setAttachedWindow(true); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 bool InspectorFrontendClientLocal::canAttachWindow() | 165 bool InspectorFrontendClientLocal::canAttachWindow() |
166 { | 166 { |
167 // Don't allow the attach if the window would be too small to accommodate th
e minimum inspector height. | 167 // Don't allow the attach if the window would be too small to accommodate th
e minimum inspector height. |
168 // Also don't allow attaching to another inspector -- two inspectors in one
window is too much! | 168 // Also don't allow attaching to another inspector -- two inspectors in one
window is too much! |
169 bool isInspectorPage = m_inspectorController->inspectedPage()->inspectorCont
roller()->hasInspectorFrontendClient(); | 169 bool isInspectorPage = m_inspectorController->hasInspectorFrontendClient(); |
170 unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainF
rame()->view()->visibleHeight(); | 170 unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainF
rame()->view()->visibleHeight(); |
171 unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeight
Ratio; | 171 unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeight
Ratio; |
172 return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage; | 172 return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage; |
173 } | 173 } |
174 | 174 |
175 void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable) | 175 void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable) |
176 { | 176 { |
177 evaluateOnLoad(String::format("[\"setDockingUnavailable\", %s]", unavailable
? "true" : "false")); | 177 evaluateOnLoad(String::format("[\"setDockingUnavailable\", %s]", unavailable
? "true" : "false")); |
178 } | 178 } |
179 | 179 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 { | 290 { |
291 using namespace std; | 291 using namespace std; |
292 return roundf(max(minimumAttachedHeight, min<float>(preferredHeight, totalWi
ndowHeight * maximumAttachedHeightRatio))); | 292 return roundf(max(minimumAttachedHeight, min<float>(preferredHeight, totalWi
ndowHeight * maximumAttachedHeightRatio))); |
293 } | 293 } |
294 | 294 |
295 void InspectorFrontendClientLocal::sendMessageToBackend(const String& message) | 295 void InspectorFrontendClientLocal::sendMessageToBackend(const String& message) |
296 { | 296 { |
297 m_dispatchTask->dispatch(message); | 297 m_dispatchTask->dispatch(message); |
298 } | 298 } |
299 | 299 |
| 300 bool InspectorFrontendClientLocal::isUnderTest() |
| 301 { |
| 302 return m_inspectorController->isUnderTest(); |
| 303 } |
| 304 |
300 bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& expression) | 305 bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& expression) |
301 { | 306 { |
302 if (!m_frontendPage->mainFrame()) | 307 if (!m_frontendPage->mainFrame()) |
303 return false; | 308 return false; |
304 ScriptValue value = m_frontendPage->mainFrame()->script()->executeScript(exp
ression); | 309 ScriptValue value = m_frontendPage->mainFrame()->script()->executeScript(exp
ression); |
305 return value.toString(mainWorldScriptState(m_frontendPage->mainFrame())) ==
"true"; | 310 return value.toString(mainWorldScriptState(m_frontendPage->mainFrame())) ==
"true"; |
306 } | 311 } |
307 | 312 |
308 void InspectorFrontendClientLocal::evaluateOnLoad(const String& expression) | 313 void InspectorFrontendClientLocal::evaluateOnLoad(const String& expression) |
309 { | 314 { |
310 if (m_frontendLoaded) | 315 if (m_frontendLoaded) |
311 m_frontendPage->mainFrame()->script()->executeScript("InspectorFrontendA
PI.dispatch(" + expression + ")"); | 316 m_frontendPage->mainFrame()->script()->executeScript("InspectorFrontendA
PI.dispatch(" + expression + ")"); |
312 else | 317 else |
313 m_evaluateOnLoad.append(expression); | 318 m_evaluateOnLoad.append(expression); |
314 } | 319 } |
315 | 320 |
316 } // namespace WebCore | 321 } // namespace WebCore |
317 | 322 |
318 #endif | 323 #endif |
OLD | NEW |