| 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/browser/extensions/api/web_request/web_request_api.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_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" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 extension_urls::IsWebstoreUpdateUrl(url_without_query) || | 153 extension_urls::IsWebstoreUpdateUrl(url_without_query) || |
| 154 extension_urls::IsBlacklistUpdateUrl(url); | 154 extension_urls::IsBlacklistUpdateUrl(url); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Returns true if the scheme is one we want to allow extensions to have access | 157 // Returns true if the scheme is one we want to allow extensions to have access |
| 158 // to. Extensions still need specific permissions for a given URL, which is | 158 // to. Extensions still need specific permissions for a given URL, which is |
| 159 // covered by CanExtensionAccessURL. | 159 // covered by CanExtensionAccessURL. |
| 160 bool HasWebRequestScheme(const GURL& url) { | 160 bool HasWebRequestScheme(const GURL& url) { |
| 161 return (url.SchemeIs(chrome::kAboutScheme) || | 161 return (url.SchemeIs(chrome::kAboutScheme) || |
| 162 url.SchemeIs(chrome::kFileScheme) || | 162 url.SchemeIs(chrome::kFileScheme) || |
| 163 url.SchemeIs(chrome::kFileSystemScheme) || |
| 163 url.SchemeIs(chrome::kFtpScheme) || | 164 url.SchemeIs(chrome::kFtpScheme) || |
| 164 url.SchemeIs(chrome::kHttpScheme) || | 165 url.SchemeIs(chrome::kHttpScheme) || |
| 165 url.SchemeIs(chrome::kHttpsScheme) || | 166 url.SchemeIs(chrome::kHttpsScheme) || |
| 166 url.SchemeIs(chrome::kExtensionScheme)); | 167 url.SchemeIs(chrome::kExtensionScheme)); |
| 167 } | 168 } |
| 168 | 169 |
| 169 // Returns true if requests for |url| shall not be reported to extensions. | 170 // Returns true if requests for |url| shall not be reported to extensions. |
| 170 bool HideRequestForURL(const GURL& url) { | 171 bool HideRequestForURL(const GURL& url) { |
| 171 return IsSensitiveURL(url) || !HasWebRequestScheme(url); | 172 return IsSensitiveURL(url) || !HasWebRequestScheme(url); |
| 172 } | 173 } |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1738 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1738 adblock = true; | 1739 adblock = true; |
| 1739 } else { | 1740 } else { |
| 1740 other = true; | 1741 other = true; |
| 1741 } | 1742 } |
| 1742 } | 1743 } |
| 1743 } | 1744 } |
| 1744 | 1745 |
| 1745 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1746 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1746 } | 1747 } |
| OLD | NEW |