OLD | NEW |
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/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "components/content_settings/content/common/content_settings_messages.h
" | 9 #include "components/content_settings/content/common/content_settings_messages.h
" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 bool allowed_per_settings, | 467 bool allowed_per_settings, |
468 const blink::WebSecurityOrigin& origin, | 468 const blink::WebSecurityOrigin& origin, |
469 const blink::WebURL& resource_url) { | 469 const blink::WebURL& resource_url) { |
470 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY); | 470 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY); |
471 | 471 |
472 std::string origin_host(origin.host().utf8()); | 472 std::string origin_host(origin.host().utf8()); |
473 WebFrame* frame = render_frame()->GetWebFrame(); | 473 WebFrame* frame = render_frame()->GetWebFrame(); |
474 GURL frame_gurl(frame->document().url()); | 474 GURL frame_gurl(frame->document().url()); |
475 if (IsHostInDomain(origin_host, kGoogleDotCom)) { | 475 if (IsHostInDomain(origin_host, kGoogleDotCom)) { |
476 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE); | 476 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE); |
477 if (StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, false)) { | 477 if (base::StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, |
| 478 false)) { |
478 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT); | 479 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT); |
479 } else if (StartsWithASCII(frame_gurl.path(), | 480 } else if (base::StartsWithASCII(frame_gurl.path(), kGoogleIntlPathPrefix, |
480 kGoogleIntlPathPrefix, | 481 false)) { |
481 false)) { | |
482 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL); | 482 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL); |
483 } | 483 } |
484 } | 484 } |
485 | 485 |
486 if (origin_host == kWWWDotGoogleDotCom) { | 486 if (origin_host == kWWWDotGoogleDotCom) { |
487 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE); | 487 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE); |
488 if (StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, false)) | 488 if (base::StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, |
| 489 false)) |
489 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER); | 490 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER); |
490 } else if (origin_host == kMailDotGoogleDotCom) { | 491 } else if (origin_host == kMailDotGoogleDotCom) { |
491 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE); | 492 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE); |
492 } else if (origin_host == kPlusDotGoogleDotCom) { | 493 } else if (origin_host == kPlusDotGoogleDotCom) { |
493 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_PLUS_GOOGLE); | 494 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_PLUS_GOOGLE); |
494 } else if (origin_host == kDocsDotGoogleDotCom) { | 495 } else if (origin_host == kDocsDotGoogleDotCom) { |
495 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_DOCS_GOOGLE); | 496 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_DOCS_GOOGLE); |
496 } else if (origin_host == kSitesDotGoogleDotCom) { | 497 } else if (origin_host == kSitesDotGoogleDotCom) { |
497 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_SITES_GOOGLE); | 498 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_SITES_GOOGLE); |
498 } else if (origin_host == kPicasawebDotGoogleDotCom) { | 499 } else if (origin_host == kPicasawebDotGoogleDotCom) { |
(...skipping 25 matching lines...) Expand all Loading... |
524 const blink::WebSecurityOrigin& origin, | 525 const blink::WebSecurityOrigin& origin, |
525 const blink::WebURL& resource_url) { | 526 const blink::WebURL& resource_url) { |
526 std::string origin_host(origin.host().utf8()); | 527 std::string origin_host(origin.host().utf8()); |
527 WebFrame* frame = render_frame()->GetWebFrame(); | 528 WebFrame* frame = render_frame()->GetWebFrame(); |
528 GURL frame_gurl(frame->document().url()); | 529 GURL frame_gurl(frame->document().url()); |
529 DCHECK_EQ(frame_gurl.host(), origin_host); | 530 DCHECK_EQ(frame_gurl.host(), origin_host); |
530 | 531 |
531 bool is_google = IsHostInDomain(origin_host, kGoogleDotCom); | 532 bool is_google = IsHostInDomain(origin_host, kGoogleDotCom); |
532 if (is_google) { | 533 if (is_google) { |
533 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE); | 534 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE); |
534 if (StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, false)) { | 535 if (base::StartsWithASCII(frame_gurl.path(), kGoogleSupportPathPrefix, |
| 536 false)) { |
535 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT); | 537 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT); |
536 } else if (StartsWithASCII(frame_gurl.path(), | 538 } else if (base::StartsWithASCII(frame_gurl.path(), kGoogleIntlPathPrefix, |
537 kGoogleIntlPathPrefix, | 539 false)) { |
538 false)) { | |
539 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL); | 540 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL); |
540 } | 541 } |
541 } | 542 } |
542 | 543 |
543 if (origin_host == kWWWDotGoogleDotCom) { | 544 if (origin_host == kWWWDotGoogleDotCom) { |
544 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE); | 545 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE); |
545 if (StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, false)) | 546 if (base::StartsWithASCII(frame_gurl.path(), kGoogleReaderPathPrefix, |
| 547 false)) |
546 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_READER); | 548 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_READER); |
547 } else if (origin_host == kMailDotGoogleDotCom) { | 549 } else if (origin_host == kMailDotGoogleDotCom) { |
548 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE); | 550 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE); |
549 } else if (origin_host == kPlusDotGoogleDotCom) { | 551 } else if (origin_host == kPlusDotGoogleDotCom) { |
550 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_PLUS_GOOGLE); | 552 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_PLUS_GOOGLE); |
551 } else if (origin_host == kDocsDotGoogleDotCom) { | 553 } else if (origin_host == kDocsDotGoogleDotCom) { |
552 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_DOCS_GOOGLE); | 554 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_DOCS_GOOGLE); |
553 } else if (origin_host == kSitesDotGoogleDotCom) { | 555 } else if (origin_host == kSitesDotGoogleDotCom) { |
554 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_SITES_GOOGLE); | 556 SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_SITES_GOOGLE); |
555 } else if (origin_host == kPicasawebDotGoogleDotCom) { | 557 } else if (origin_host == kPicasawebDotGoogleDotCom) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 717 |
716 // If the scheme is file:, an empty file name indicates a directory listing, | 718 // If the scheme is file:, an empty file name indicates a directory listing, |
717 // which requires JavaScript to function properly. | 719 // which requires JavaScript to function properly. |
718 if (base::EqualsASCII(origin.protocol(), url::kFileScheme)) { | 720 if (base::EqualsASCII(origin.protocol(), url::kFileScheme)) { |
719 return document_url.SchemeIs(url::kFileScheme) && | 721 return document_url.SchemeIs(url::kFileScheme) && |
720 document_url.ExtractFileName().empty(); | 722 document_url.ExtractFileName().empty(); |
721 } | 723 } |
722 | 724 |
723 return false; | 725 return false; |
724 } | 726 } |
OLD | NEW |