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