LocalFrame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& frameId) { LocalFrame* frame = frameForId(frameId); if (!frame) *errorString = "No frame for given id found"; return frame; }
void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >& results) { results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); bool isRegex = optionalIsRegex ? *optionalIsRegex : false; bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; LocalFrame* frame = frameForId(frameId); KURL kurl(ParsedURLString, url); FrameLoader* frameLoader = frame ? &frame->loader() : 0; DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0; if (!loader) return; String content; bool success = false; Resource* resource = cachedResource(frame, kurl); if (resource) success = textContentForResource(resource, &content); if (!success) return; results = ContentSearchUtils::searchInTextByLines(content, query, caseSensitive, isRegex); }
void InspectorPageAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, String* content, bool* base64Encoded) { Frame* frame = frameForId(frameId); if (!frame) { *errorString = "No frame for given id found"; return; } resourceContent(errorString, frame, KURL(ParsedURLString, url), content, base64Encoded); }
void InspectorPageAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, const bool* const optionalBase64Encode, String* content) { Frame* frame = frameForId(frameId); if (!frame) { *errorString = "No frame for given id found"; return; } if (optionalBase64Encode ? *optionalBase64Encode : false) InspectorPageAgent::resourceContentBase64(errorString, frame, KURL(ParsedURLString, url), content); else InspectorPageAgent::resourceContent(errorString, frame, KURL(ParsedURLString, url), content); }