OLD | NEW |
1 // Copyright (c) 2011 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/browser/extensions/extension_webrequest_api.h" | 5 #include "chrome/browser/extensions/extension_webrequest_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/string_util.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chrome_content_browser_client.h" | 18 #include "chrome/browser/chrome_content_browser_client.h" |
18 #include "chrome/browser/extensions/extension_event_router.h" | 19 #include "chrome/browser/extensions/extension_event_router.h" |
19 #include "chrome/browser/extensions/extension_info_map.h" | 20 #include "chrome/browser/extensions/extension_info_map.h" |
20 #include "chrome/browser/extensions/extension_prefs.h" | 21 #include "chrome/browser/extensions/extension_prefs.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/extension_tab_id_map.h" | 23 #include "chrome/browser/extensions/extension_tab_id_map.h" |
23 #include "chrome/browser/extensions/extension_webrequest_api_constants.h" | 24 #include "chrome/browser/extensions/extension_webrequest_api_constants.h" |
24 #include "chrome/browser/extensions/extension_webrequest_api_helpers.h" | 25 #include "chrome/browser/extensions/extension_webrequest_api_helpers.h" |
25 #include "chrome/browser/extensions/extension_webrequest_time_tracker.h" | 26 #include "chrome/browser/extensions/extension_webrequest_time_tracker.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
28 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 29 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
29 #include "chrome/browser/renderer_host/web_cache_manager.h" | 30 #include "chrome/browser/renderer_host/web_cache_manager.h" |
30 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
| 32 #include "chrome/common/extensions/extension_constants.h" |
31 #include "chrome/common/extensions/extension_error_utils.h" | 33 #include "chrome/common/extensions/extension_error_utils.h" |
32 #include "chrome/common/extensions/extension_messages.h" | 34 #include "chrome/common/extensions/extension_messages.h" |
33 #include "chrome/common/extensions/url_pattern.h" | 35 #include "chrome/common/extensions/url_pattern.h" |
34 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
35 #include "content/browser/browser_message_filter.h" | 37 #include "content/browser/browser_message_filter.h" |
36 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 38 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
37 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 39 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
38 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
39 #include "googleurl/src/gurl.h" | 41 #include "googleurl/src/gurl.h" |
40 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ResourceDispatcherHost::InfoForRequest(request); | 128 ResourceDispatcherHost::InfoForRequest(request); |
127 | 129 |
128 // If this request was not created by the ResourceDispatcher, |info| is NULL. | 130 // If this request was not created by the ResourceDispatcher, |info| is NULL. |
129 // All requests from extensions are created by the ResourceDispatcher. | 131 // All requests from extensions are created by the ResourceDispatcher. |
130 if (!info) | 132 if (!info) |
131 return false; | 133 return false; |
132 | 134 |
133 return extension_info_map->process_map().Contains(info->child_id()); | 135 return extension_info_map->process_map().Contains(info->child_id()); |
134 } | 136 } |
135 | 137 |
| 138 // Returns true if the URL is sensitive and requests to this URL must not be |
| 139 // modified/canceled by extensions, e.g. because it is targeted to the webstore |
| 140 // to check for updates, extension blacklisting, etc. |
| 141 bool IsSensitiveURL(const GURL& url) { |
| 142 bool is_webstore_gallery_url = |
| 143 StartsWithASCII(url.spec(), extension_urls::kGalleryBrowsePrefix, true); |
| 144 bool is_google_com_chrome_url = |
| 145 EndsWith(url.host(), "google.com", true) && |
| 146 StartsWithASCII(url.path(), "/chrome", true); |
| 147 std::string url_without_query = |
| 148 url.spec().substr(0, url.spec().find_first_of('?')); |
| 149 return is_webstore_gallery_url || is_google_com_chrome_url || |
| 150 extension_urls::IsWebstoreUpdateUrl(GURL(url_without_query)) || |
| 151 extension_urls::IsBlacklistUpdateUrl(url); |
| 152 } |
| 153 |
136 // Returns true if the scheme is one we want to allow extensions to have access | 154 // Returns true if the scheme is one we want to allow extensions to have access |
137 // to. Extensions still need specific permissions for a given URL, which is | 155 // to. Extensions still need specific permissions for a given URL, which is |
138 // covered by CanExtensionAccessURL. | 156 // covered by CanExtensionAccessURL. |
139 bool HasWebRequestScheme(const GURL& url) { | 157 bool HasWebRequestScheme(const GURL& url) { |
140 return (url.SchemeIs(chrome::kAboutScheme) || | 158 return (url.SchemeIs(chrome::kAboutScheme) || |
141 url.SchemeIs(chrome::kFileScheme) || | 159 url.SchemeIs(chrome::kFileScheme) || |
142 url.SchemeIs(chrome::kFtpScheme) || | 160 url.SchemeIs(chrome::kFtpScheme) || |
143 url.SchemeIs(chrome::kHttpScheme) || | 161 url.SchemeIs(chrome::kHttpScheme) || |
144 url.SchemeIs(chrome::kHttpsScheme) || | 162 url.SchemeIs(chrome::kHttpsScheme) || |
145 url.SchemeIs(chrome::kExtensionScheme)); | 163 url.SchemeIs(chrome::kExtensionScheme)); |
146 } | 164 } |
147 | 165 |
| 166 // Returns true if requests for |url| shall not be reported to extensions. |
| 167 bool HideRequestForURL(const GURL& url) { |
| 168 return IsSensitiveURL(url) || !HasWebRequestScheme(url); |
| 169 } |
| 170 |
148 bool CanExtensionAccessURL(const Extension* extension, const GURL& url) { | 171 bool CanExtensionAccessURL(const Extension* extension, const GURL& url) { |
149 // about: URLs are not covered in host permissions, but are allowed anyway. | 172 // about: URLs are not covered in host permissions, but are allowed anyway. |
150 return (url.SchemeIs(chrome::kAboutScheme) || | 173 return (url.SchemeIs(chrome::kAboutScheme) || |
151 extension->HasHostPermission(url) || | 174 extension->HasHostPermission(url) || |
152 url.GetOrigin() == extension->url()); | 175 url.GetOrigin() == extension->url()); |
153 } | 176 } |
154 | 177 |
155 const char* ResourceTypeToString(ResourceType::Type type) { | 178 const char* ResourceTypeToString(ResourceType::Type type) { |
156 ResourceType::Type* iter = | 179 ResourceType::Type* iter = |
157 std::find(kResourceTypeValues, ARRAYEND(kResourceTypeValues), type); | 180 std::find(kResourceTypeValues, ARRAYEND(kResourceTypeValues), type); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 542 |
520 ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { | 543 ExtensionWebRequestEventRouter::~ExtensionWebRequestEventRouter() { |
521 } | 544 } |
522 | 545 |
523 int ExtensionWebRequestEventRouter::OnBeforeRequest( | 546 int ExtensionWebRequestEventRouter::OnBeforeRequest( |
524 void* profile, | 547 void* profile, |
525 ExtensionInfoMap* extension_info_map, | 548 ExtensionInfoMap* extension_info_map, |
526 net::URLRequest* request, | 549 net::URLRequest* request, |
527 const net::CompletionCallback& callback, | 550 const net::CompletionCallback& callback, |
528 GURL* new_url) { | 551 GURL* new_url) { |
529 // TODO(jochen): Figure out what to do with events from the system context. | 552 // We hide events from the system context as well as sensitive requests. |
530 if (!profile) | 553 if (!profile || HideRequestForURL(request->url())) |
531 return net::OK; | 554 return net::OK; |
532 | 555 |
533 if (IsPageLoad(request)) | 556 if (IsPageLoad(request)) |
534 NotifyPageLoad(); | 557 NotifyPageLoad(); |
535 | 558 |
536 if (!HasWebRequestScheme(request->url())) | |
537 return net::OK; | |
538 | |
539 request_time_tracker_->LogRequestStartTime(request->identifier(), | 559 request_time_tracker_->LogRequestStartTime(request->identifier(), |
540 base::Time::Now(), | 560 base::Time::Now(), |
541 request->url(), | 561 request->url(), |
542 profile); | 562 profile); |
543 | 563 |
544 int extra_info_spec = 0; | 564 int extra_info_spec = 0; |
545 std::vector<const EventListener*> listeners = | 565 std::vector<const EventListener*> listeners = |
546 GetMatchingListeners(profile, extension_info_map, keys::kOnBeforeRequest, | 566 GetMatchingListeners(profile, extension_info_map, keys::kOnBeforeRequest, |
547 request, &extra_info_spec); | 567 request, &extra_info_spec); |
548 if (listeners.empty()) | 568 if (listeners.empty()) |
(...skipping 16 matching lines...) Expand all Loading... |
565 } | 585 } |
566 return net::OK; | 586 return net::OK; |
567 } | 587 } |
568 | 588 |
569 int ExtensionWebRequestEventRouter::OnBeforeSendHeaders( | 589 int ExtensionWebRequestEventRouter::OnBeforeSendHeaders( |
570 void* profile, | 590 void* profile, |
571 ExtensionInfoMap* extension_info_map, | 591 ExtensionInfoMap* extension_info_map, |
572 net::URLRequest* request, | 592 net::URLRequest* request, |
573 const net::CompletionCallback& callback, | 593 const net::CompletionCallback& callback, |
574 net::HttpRequestHeaders* headers) { | 594 net::HttpRequestHeaders* headers) { |
575 // TODO(jochen): Figure out what to do with events from the system context. | 595 // We hide events from the system context as well as sensitive requests. |
576 if (!profile) | 596 if (!profile || HideRequestForURL(request->url())) |
577 return net::OK; | |
578 | |
579 if (!HasWebRequestScheme(request->url())) | |
580 return net::OK; | 597 return net::OK; |
581 | 598 |
582 if (GetAndSetSignaled(request->identifier(), kOnBeforeSendHeaders)) | 599 if (GetAndSetSignaled(request->identifier(), kOnBeforeSendHeaders)) |
583 return net::OK; | 600 return net::OK; |
584 | 601 |
585 int extra_info_spec = 0; | 602 int extra_info_spec = 0; |
586 std::vector<const EventListener*> listeners = | 603 std::vector<const EventListener*> listeners = |
587 GetMatchingListeners(profile, extension_info_map, | 604 GetMatchingListeners(profile, extension_info_map, |
588 keys::kOnBeforeSendHeaders, request, | 605 keys::kOnBeforeSendHeaders, request, |
589 &extra_info_spec); | 606 &extra_info_spec); |
(...skipping 15 matching lines...) Expand all Loading... |
605 return net::ERR_IO_PENDING; | 622 return net::ERR_IO_PENDING; |
606 } | 623 } |
607 return net::OK; | 624 return net::OK; |
608 } | 625 } |
609 | 626 |
610 void ExtensionWebRequestEventRouter::OnSendHeaders( | 627 void ExtensionWebRequestEventRouter::OnSendHeaders( |
611 void* profile, | 628 void* profile, |
612 ExtensionInfoMap* extension_info_map, | 629 ExtensionInfoMap* extension_info_map, |
613 net::URLRequest* request, | 630 net::URLRequest* request, |
614 const net::HttpRequestHeaders& headers) { | 631 const net::HttpRequestHeaders& headers) { |
615 if (!profile) | 632 // We hide events from the system context as well as sensitive requests. |
616 return; | 633 if (!profile || HideRequestForURL(request->url())) |
617 | |
618 if (!HasWebRequestScheme(request->url())) | |
619 return; | 634 return; |
620 | 635 |
621 if (GetAndSetSignaled(request->identifier(), kOnSendHeaders)) | 636 if (GetAndSetSignaled(request->identifier(), kOnSendHeaders)) |
622 return; | 637 return; |
623 | 638 |
624 ClearSignaled(request->identifier(), kOnBeforeRedirect); | 639 ClearSignaled(request->identifier(), kOnBeforeRedirect); |
625 | 640 |
626 int extra_info_spec = 0; | 641 int extra_info_spec = 0; |
627 std::vector<const EventListener*> listeners = | 642 std::vector<const EventListener*> listeners = |
628 GetMatchingListeners(profile, extension_info_map, | 643 GetMatchingListeners(profile, extension_info_map, |
(...skipping 11 matching lines...) Expand all Loading... |
640 DispatchEvent(profile, request, listeners, args); | 655 DispatchEvent(profile, request, listeners, args); |
641 } | 656 } |
642 | 657 |
643 int ExtensionWebRequestEventRouter::OnHeadersReceived( | 658 int ExtensionWebRequestEventRouter::OnHeadersReceived( |
644 void* profile, | 659 void* profile, |
645 ExtensionInfoMap* extension_info_map, | 660 ExtensionInfoMap* extension_info_map, |
646 net::URLRequest* request, | 661 net::URLRequest* request, |
647 const net::CompletionCallback& callback, | 662 const net::CompletionCallback& callback, |
648 net::HttpResponseHeaders* original_response_headers, | 663 net::HttpResponseHeaders* original_response_headers, |
649 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { | 664 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { |
650 if (!profile) | 665 // We hide events from the system context as well as sensitive requests. |
651 return net::OK; | 666 if (!profile || HideRequestForURL(request->url())) |
652 | |
653 if (!HasWebRequestScheme(request->url())) | |
654 return net::OK; | 667 return net::OK; |
655 | 668 |
656 int extra_info_spec = 0; | 669 int extra_info_spec = 0; |
657 std::vector<const EventListener*> listeners = | 670 std::vector<const EventListener*> listeners = |
658 GetMatchingListeners(profile, extension_info_map, | 671 GetMatchingListeners(profile, extension_info_map, |
659 keys::kOnHeadersReceived, request, | 672 keys::kOnHeadersReceived, request, |
660 &extra_info_spec); | 673 &extra_info_spec); |
661 | 674 |
662 if (listeners.empty()) | 675 if (listeners.empty()) |
663 return net::OK; | 676 return net::OK; |
(...skipping 27 matching lines...) Expand all Loading... |
691 | 704 |
692 net::NetworkDelegate::AuthRequiredResponse | 705 net::NetworkDelegate::AuthRequiredResponse |
693 ExtensionWebRequestEventRouter::OnAuthRequired( | 706 ExtensionWebRequestEventRouter::OnAuthRequired( |
694 void* profile, | 707 void* profile, |
695 ExtensionInfoMap* extension_info_map, | 708 ExtensionInfoMap* extension_info_map, |
696 net::URLRequest* request, | 709 net::URLRequest* request, |
697 const net::AuthChallengeInfo& auth_info, | 710 const net::AuthChallengeInfo& auth_info, |
698 const net::NetworkDelegate::AuthCallback& callback, | 711 const net::NetworkDelegate::AuthCallback& callback, |
699 net::AuthCredentials* credentials) { | 712 net::AuthCredentials* credentials) { |
700 // No profile means that this is for authentication challenges in the | 713 // No profile means that this is for authentication challenges in the |
701 // system context. Skip in that case. | 714 // system context. Skip in that case. Also skip sensitive requests. |
702 if (!profile) | 715 if (!profile || HideRequestForURL(request->url())) |
703 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | |
704 | |
705 if (!HasWebRequestScheme(request->url())) | |
706 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 716 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
707 | 717 |
708 int extra_info_spec = 0; | 718 int extra_info_spec = 0; |
709 std::vector<const EventListener*> listeners = | 719 std::vector<const EventListener*> listeners = |
710 GetMatchingListeners(profile, extension_info_map, | 720 GetMatchingListeners(profile, extension_info_map, |
711 keys::kOnAuthRequired, request, &extra_info_spec); | 721 keys::kOnAuthRequired, request, &extra_info_spec); |
712 if (listeners.empty()) | 722 if (listeners.empty()) |
713 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 723 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
714 | 724 |
715 ListValue args; | 725 ListValue args; |
(...skipping 23 matching lines...) Expand all Loading... |
739 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_IO_PENDING; | 749 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_IO_PENDING; |
740 } | 750 } |
741 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 751 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
742 } | 752 } |
743 | 753 |
744 void ExtensionWebRequestEventRouter::OnBeforeRedirect( | 754 void ExtensionWebRequestEventRouter::OnBeforeRedirect( |
745 void* profile, | 755 void* profile, |
746 ExtensionInfoMap* extension_info_map, | 756 ExtensionInfoMap* extension_info_map, |
747 net::URLRequest* request, | 757 net::URLRequest* request, |
748 const GURL& new_location) { | 758 const GURL& new_location) { |
749 if (!profile) | 759 // We hide events from the system context as well as sensitive requests. |
750 return; | 760 if (!profile || HideRequestForURL(request->url())) |
751 | |
752 if (!HasWebRequestScheme(request->url())) | |
753 return; | 761 return; |
754 | 762 |
755 if (GetAndSetSignaled(request->identifier(), kOnBeforeRedirect)) | 763 if (GetAndSetSignaled(request->identifier(), kOnBeforeRedirect)) |
756 return; | 764 return; |
757 | 765 |
758 ClearSignaled(request->identifier(), kOnBeforeRequest); | 766 ClearSignaled(request->identifier(), kOnBeforeRequest); |
759 ClearSignaled(request->identifier(), kOnBeforeSendHeaders); | 767 ClearSignaled(request->identifier(), kOnBeforeSendHeaders); |
760 ClearSignaled(request->identifier(), kOnSendHeaders); | 768 ClearSignaled(request->identifier(), kOnSendHeaders); |
761 ClearSignaled(request->identifier(), kOnHeadersReceived); | 769 ClearSignaled(request->identifier(), kOnHeadersReceived); |
762 | 770 |
(...skipping 23 matching lines...) Expand all Loading... |
786 } | 794 } |
787 args.Append(dict); | 795 args.Append(dict); |
788 | 796 |
789 DispatchEvent(profile, request, listeners, args); | 797 DispatchEvent(profile, request, listeners, args); |
790 } | 798 } |
791 | 799 |
792 void ExtensionWebRequestEventRouter::OnResponseStarted( | 800 void ExtensionWebRequestEventRouter::OnResponseStarted( |
793 void* profile, | 801 void* profile, |
794 ExtensionInfoMap* extension_info_map, | 802 ExtensionInfoMap* extension_info_map, |
795 net::URLRequest* request) { | 803 net::URLRequest* request) { |
796 if (!profile) | 804 // We hide events from the system context as well as sensitive requests. |
797 return; | 805 if (!profile || HideRequestForURL(request->url())) |
798 | |
799 if (!HasWebRequestScheme(request->url())) | |
800 return; | 806 return; |
801 | 807 |
802 // OnResponseStarted is even triggered, when the request was cancelled. | 808 // OnResponseStarted is even triggered, when the request was cancelled. |
803 if (request->status().status() != net::URLRequestStatus::SUCCESS) | 809 if (request->status().status() != net::URLRequestStatus::SUCCESS) |
804 return; | 810 return; |
805 | 811 |
806 int extra_info_spec = 0; | 812 int extra_info_spec = 0; |
807 std::vector<const EventListener*> listeners = | 813 std::vector<const EventListener*> listeners = |
808 GetMatchingListeners(profile, extension_info_map, | 814 GetMatchingListeners(profile, extension_info_map, |
809 keys::kOnResponseStarted, request, &extra_info_spec); | 815 keys::kOnResponseStarted, request, &extra_info_spec); |
(...skipping 21 matching lines...) Expand all Loading... |
831 } | 837 } |
832 args.Append(dict); | 838 args.Append(dict); |
833 | 839 |
834 DispatchEvent(profile, request, listeners, args); | 840 DispatchEvent(profile, request, listeners, args); |
835 } | 841 } |
836 | 842 |
837 void ExtensionWebRequestEventRouter::OnCompleted( | 843 void ExtensionWebRequestEventRouter::OnCompleted( |
838 void* profile, | 844 void* profile, |
839 ExtensionInfoMap* extension_info_map, | 845 ExtensionInfoMap* extension_info_map, |
840 net::URLRequest* request) { | 846 net::URLRequest* request) { |
841 if (!profile) | 847 // We hide events from the system context as well as sensitive requests. |
842 return; | 848 if (!profile || HideRequestForURL(request->url())) |
843 | |
844 if (!HasWebRequestScheme(request->url())) | |
845 return; | 849 return; |
846 | 850 |
847 request_time_tracker_->LogRequestEndTime(request->identifier(), | 851 request_time_tracker_->LogRequestEndTime(request->identifier(), |
848 base::Time::Now()); | 852 base::Time::Now()); |
849 | 853 |
850 DCHECK(request->status().status() == net::URLRequestStatus::SUCCESS); | 854 DCHECK(request->status().status() == net::URLRequestStatus::SUCCESS); |
851 | 855 |
852 DCHECK(!GetAndSetSignaled(request->identifier(), kOnCompleted)); | 856 DCHECK(!GetAndSetSignaled(request->identifier(), kOnCompleted)); |
853 | 857 |
854 int extra_info_spec = 0; | 858 int extra_info_spec = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
879 } | 883 } |
880 args.Append(dict); | 884 args.Append(dict); |
881 | 885 |
882 DispatchEvent(profile, request, listeners, args); | 886 DispatchEvent(profile, request, listeners, args); |
883 } | 887 } |
884 | 888 |
885 void ExtensionWebRequestEventRouter::OnErrorOccurred( | 889 void ExtensionWebRequestEventRouter::OnErrorOccurred( |
886 void* profile, | 890 void* profile, |
887 ExtensionInfoMap* extension_info_map, | 891 ExtensionInfoMap* extension_info_map, |
888 net::URLRequest* request) { | 892 net::URLRequest* request) { |
889 if (!profile) | 893 // We hide events from the system context as well as sensitive requests. |
890 return; | 894 if (!profile || HideRequestForURL(request->url())) |
891 | |
892 if (!HasWebRequestScheme(request->url())) | |
893 return; | 895 return; |
894 | 896 |
895 request_time_tracker_->LogRequestEndTime(request->identifier(), | 897 request_time_tracker_->LogRequestEndTime(request->identifier(), |
896 base::Time::Now()); | 898 base::Time::Now()); |
897 | 899 |
898 DCHECK(request->status().status() == net::URLRequestStatus::FAILED || | 900 DCHECK(request->status().status() == net::URLRequestStatus::FAILED || |
899 request->status().status() == net::URLRequestStatus::CANCELED); | 901 request->status().status() == net::URLRequestStatus::CANCELED); |
900 | 902 |
901 DCHECK(!GetAndSetSignaled(request->identifier(), kOnErrorOccurred)); | 903 DCHECK(!GetAndSetSignaled(request->identifier(), kOnErrorOccurred)); |
902 | 904 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1710 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
1709 adblock = true; | 1711 adblock = true; |
1710 } else { | 1712 } else { |
1711 other = true; | 1713 other = true; |
1712 } | 1714 } |
1713 } | 1715 } |
1714 } | 1716 } |
1715 | 1717 |
1716 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1718 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
1717 } | 1719 } |
OLD | NEW |