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

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

Issue 8371003: Merge 97851 - Web Inspector: Enable caseSensitive search / Regex support in advanced search. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 String content; 477 String content;
478 bool base64Encoded; 478 bool base64Encoded;
479 if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &b ase64Encoded)) { 479 if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &b ase64Encoded)) {
480 ASSERT(!base64Encoded); 480 ASSERT(!base64Encoded);
481 return true; 481 return true;
482 } 482 }
483 } 483 }
484 return false; 484 return false;
485 } 485 }
486 486
487 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c onst String& url, const String& query, RefPtr<InspectorArray>* results) 487 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c onst String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<InspectorArray>* results)
488 { 488 {
489 *results = InspectorArray::create(); 489 *results = InspectorArray::create();
490 490
491 bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
492 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
493
491 Frame* frame = frameForId(frameId); 494 Frame* frame = frameForId(frameId);
492 KURL kurl(ParsedURLString, url); 495 KURL kurl(ParsedURLString, url);
493 496
494 FrameLoader* frameLoader = frame ? frame->loader() : 0; 497 FrameLoader* frameLoader = frame ? frame->loader() : 0;
495 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0; 498 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0;
496 if (!loader) 499 if (!loader)
497 return; 500 return;
498 501
499 String content; 502 String content;
500 bool success = false; 503 bool success = false;
501 if (equalIgnoringFragmentIdentifier(kurl, loader->url())) 504 if (equalIgnoringFragmentIdentifier(kurl, loader->url()))
502 success = mainResourceContent(frame, false, &content); 505 success = mainResourceContent(frame, false, &content);
503 506
504 if (!success) { 507 if (!success) {
505 CachedResource* resource = cachedResource(frame, kurl); 508 CachedResource* resource = cachedResource(frame, kurl);
506 if (resource) 509 if (resource)
507 success = textContentForCachedResource(resource, &content); 510 success = textContentForCachedResource(resource, &content);
508 } 511 }
509 512
510 if (!success) 513 if (!success)
511 return; 514 return;
512 515
513 *results = ContentSearchUtils::searchInTextByLines(query, content); 516 *results = ContentSearchUtils::searchInTextByLines(content, query, caseSensi tive, isRegex);
514 } 517 }
515 518
516 static PassRefPtr<InspectorObject> buildObjectForSearchResult(const String& fram eId, const String& url, int matchesCount) 519 static PassRefPtr<InspectorObject> buildObjectForSearchResult(const String& fram eId, const String& url, int matchesCount)
517 { 520 {
518 RefPtr<InspectorObject> result = InspectorObject::create(); 521 RefPtr<InspectorObject> result = InspectorObject::create();
519 result->setString("frameId", frameId); 522 result->setString("frameId", frameId);
520 result->setString("url", url); 523 result->setString("url", url);
521 result->setNumber("matchesCount", matchesCount); 524 result->setNumber("matchesCount", matchesCount);
522 525
523 return result; 526 return result;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 result->setArray("childFrames", childrenArray); 684 result->setArray("childFrames", childrenArray);
682 } 685 }
683 childrenArray->pushObject(buildObjectForFrameTree(child)); 686 childrenArray->pushObject(buildObjectForFrameTree(child));
684 } 687 }
685 return result; 688 return result;
686 } 689 }
687 690
688 } // namespace WebCore 691 } // namespace WebCore
689 692
690 #endif // ENABLE(INSPECTOR) 693 #endif // ENABLE(INSPECTOR)
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/InspectorPageAgent.h ('k') | Source/WebCore/inspector/front-end/AdvancedSearchController.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698