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

Side by Side Diff: chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 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
« no previous file with comments | « chrome/renderer/content_settings_observer.cc ('k') | chrome/renderer/web_apps.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" 5 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 cur_document_.Url(), 383 cur_document_.Url(),
384 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); 384 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
385 } 385 }
386 386
387 blink::WebDocument PhishingDOMFeatureExtractor::GetNextDocument() { 387 blink::WebDocument PhishingDOMFeatureExtractor::GetNextDocument() {
388 DCHECK(!cur_document_.IsNull()); 388 DCHECK(!cur_document_.IsNull());
389 blink::WebFrame* frame = cur_document_.GetFrame(); 389 blink::WebFrame* frame = cur_document_.GetFrame();
390 // Advance to the next frame that contains a document, with no wrapping. 390 // Advance to the next frame that contains a document, with no wrapping.
391 if (frame) { 391 if (frame) {
392 for (frame = frame->TraverseNext(); frame; frame = frame->TraverseNext()) { 392 for (frame = frame->TraverseNext(); frame; frame = frame->TraverseNext()) {
393 if (!frame->GetDocument().IsNull()) { 393 // TODO(dcheng): Verify if the WebDocument::IsNull check is really needed.
394 return frame->GetDocument(); 394 if (frame->IsWebLocalFrame() &&
395 !frame->ToWebLocalFrame()->GetDocument().IsNull()) {
396 return frame->ToWebLocalFrame()->GetDocument();
395 } 397 }
396 } 398 }
397 } else { 399 } else {
398 // Keep track of how often frame traversal got "stuck" due to the 400 // Keep track of how often frame traversal got "stuck" due to the
399 // current subdocument getting removed from the frame tree. 401 // current subdocument getting removed from the frame tree.
400 UMA_HISTOGRAM_COUNTS("SBClientPhishing.DOMFeatureFrameRemoved", 1); 402 UMA_HISTOGRAM_COUNTS("SBClientPhishing.DOMFeatureFrameRemoved", 1);
401 } 403 }
402 return blink::WebDocument(); 404 return blink::WebDocument();
403 } 405 }
404 406
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Record number of script tags (discretized for numerical stability.) 495 // Record number of script tags (discretized for numerical stability.)
494 if (page_feature_state_->num_script_tags > 1) { 496 if (page_feature_state_->num_script_tags > 1) {
495 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne); 497 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne);
496 if (page_feature_state_->num_script_tags > 6) { 498 if (page_feature_state_->num_script_tags > 6) {
497 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix); 499 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix);
498 } 500 }
499 } 501 }
500 } 502 }
501 503
502 } // namespace safe_browsing 504 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer.cc ('k') | chrome/renderer/web_apps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698