| OLD | NEW |
| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 *error = "Script not found"; | 537 *error = "Script not found"; |
| 538 return; | 538 return; |
| 539 } | 539 } |
| 540 scripts->remove(identifier); | 540 scripts->remove(identifier); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa
che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP
reprocessor) | 543 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa
che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP
reprocessor) |
| 544 { | 544 { |
| 545 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti
onalScriptToEvaluateOnLoad : ""; | 545 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti
onalScriptToEvaluateOnLoad : ""; |
| 546 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr
eprocessor : ""; | 546 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr
eprocessor : ""; |
| 547 m_page->deprecatedLocalMainFrame()->loader().reload(optionalIgnoreCache && *
optionalIgnoreCache ? EndToEndReload : NormalReload); | 547 m_page->deprecatedLocalMainFrame()->loader().reload(asBool(optionalIgnoreCac
he) ? EndToEndReload : NormalReload); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void InspectorPageAgent::navigate(ErrorString*, const String& url, String* outFr
ameId) | 550 void InspectorPageAgent::navigate(ErrorString*, const String& url, String* outFr
ameId) |
| 551 { | 551 { |
| 552 LocalFrame* frame = m_page->deprecatedLocalMainFrame(); | 552 LocalFrame* frame = m_page->deprecatedLocalMainFrame(); |
| 553 *outFrameId = frameId(frame); | 553 *outFrameId = frameId(frame); |
| 554 } | 554 } |
| 555 | 555 |
| 556 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie&
cookie) | 556 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie&
cookie) |
| 557 { | 557 { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 return true; | 732 return true; |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 return false; | 735 return false; |
| 736 } | 736 } |
| 737 | 737 |
| 738 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c
onst String& url, const String& query, const bool* const optionalCaseSensitive,
const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::
SearchMatch> >& results) | 738 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c
onst String& url, const String& query, const bool* const optionalCaseSensitive,
const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::
SearchMatch> >& results) |
| 739 { | 739 { |
| 740 results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); | 740 results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); |
| 741 | 741 |
| 742 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; | |
| 743 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; | |
| 744 | |
| 745 LocalFrame* frame = frameForId(frameId); | 742 LocalFrame* frame = frameForId(frameId); |
| 746 KURL kurl(ParsedURLString, url); | 743 KURL kurl(ParsedURLString, url); |
| 747 | 744 |
| 748 FrameLoader* frameLoader = frame ? &frame->loader() : 0; | 745 FrameLoader* frameLoader = frame ? &frame->loader() : 0; |
| 749 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0; | 746 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0; |
| 750 if (!loader) | 747 if (!loader) |
| 751 return; | 748 return; |
| 752 | 749 |
| 753 String content; | 750 String content; |
| 754 bool success = false; | 751 bool success = false; |
| 755 Resource* resource = cachedResource(frame, kurl); | 752 Resource* resource = cachedResource(frame, kurl); |
| 756 if (resource) | 753 if (resource) |
| 757 success = textContentForResource(resource, &content); | 754 success = textContentForResource(resource, &content); |
| 758 | 755 |
| 759 if (!success) | 756 if (!success) |
| 760 return; | 757 return; |
| 761 | 758 |
| 762 results = ContentSearchUtils::searchInTextByLines(content, query, caseSensit
ive, isRegex); | 759 results = ContentSearchUtils::searchInTextByLines(content, query, asBool(opt
ionalCaseSensitive), asBool(optionalIsRegex)); |
| 763 } | 760 } |
| 764 | 761 |
| 765 void InspectorPageAgent::setDocumentContent(ErrorString* errorString, const Stri
ng& frameId, const String& html) | 762 void InspectorPageAgent::setDocumentContent(ErrorString* errorString, const Stri
ng& frameId, const String& html) |
| 766 { | 763 { |
| 767 LocalFrame* frame = assertFrame(errorString, frameId); | 764 LocalFrame* frame = assertFrame(errorString, frameId); |
| 768 if (!frame) | 765 if (!frame) |
| 769 return; | 766 return; |
| 770 | 767 |
| 771 Document* document = frame->document(); | 768 Document* document = frame->document(); |
| 772 if (!document) { | 769 if (!document) { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 if (errorString) | 1395 if (errorString) |
| 1399 *errorString = "Compositing mode is not supported"; | 1396 *errorString = "Compositing mode is not supported"; |
| 1400 return false; | 1397 return false; |
| 1401 } | 1398 } |
| 1402 return true; | 1399 return true; |
| 1403 } | 1400 } |
| 1404 | 1401 |
| 1405 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) | 1402 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) |
| 1406 { | 1403 { |
| 1407 m_state->setBoolean(PageAgentState::showSizeOnResize, show); | 1404 m_state->setBoolean(PageAgentState::showSizeOnResize, show); |
| 1408 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid)
; | 1405 m_state->setBoolean(PageAgentState::showGridOnResize, asBool(showGrid)); |
| 1409 } | 1406 } |
| 1410 | 1407 |
| 1411 void InspectorPageAgent::clearEditedResourcesContent() | 1408 void InspectorPageAgent::clearEditedResourcesContent() |
| 1412 { | 1409 { |
| 1413 m_editedResourceContent.clear(); | 1410 m_editedResourceContent.clear(); |
| 1414 } | 1411 } |
| 1415 | 1412 |
| 1416 void InspectorPageAgent::addEditedResourceContent(const String& url, const Strin
g& content) | 1413 void InspectorPageAgent::addEditedResourceContent(const String& url, const Strin
g& content) |
| 1417 { | 1414 { |
| 1418 m_editedResourceContent.set(url, content); | 1415 m_editedResourceContent.set(url, content); |
| 1419 } | 1416 } |
| 1420 | 1417 |
| 1421 bool InspectorPageAgent::getEditedResourceContent(const String& url, String* con
tent) | 1418 bool InspectorPageAgent::getEditedResourceContent(const String& url, String* con
tent) |
| 1422 { | 1419 { |
| 1423 if (!m_editedResourceContent.contains(url)) | 1420 if (!m_editedResourceContent.contains(url)) |
| 1424 return false; | 1421 return false; |
| 1425 *content = m_editedResourceContent.get(url); | 1422 *content = m_editedResourceContent.get(url); |
| 1426 return true; | 1423 return true; |
| 1427 } | 1424 } |
| 1428 | 1425 |
| 1429 void InspectorPageAgent::trace(Visitor* visitor) | 1426 void InspectorPageAgent::trace(Visitor* visitor) |
| 1430 { | 1427 { |
| 1431 visitor->trace(m_page); | 1428 visitor->trace(m_page); |
| 1432 visitor->trace(m_injectedScriptManager); | 1429 visitor->trace(m_injectedScriptManager); |
| 1433 InspectorBaseAgent::trace(visitor); | 1430 InspectorBaseAgent::trace(visitor); |
| 1434 } | 1431 } |
| 1435 | 1432 |
| 1436 } // namespace blink | 1433 } // namespace blink |
| 1437 | 1434 |
| OLD | NEW |