OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 return extension_info_map->process_map().Contains(info->child_id()); | 134 return extension_info_map->process_map().Contains(info->child_id()); |
135 } | 135 } |
136 | 136 |
137 // Returns true if the scheme is one we want to allow extensions to have access | 137 // Returns true if the scheme is one we want to allow extensions to have access |
138 // to. Extensions still need specific permissions for a given URL, which is | 138 // to. Extensions still need specific permissions for a given URL, which is |
139 // covered by CanExtensionAccessURL. | 139 // covered by CanExtensionAccessURL. |
140 bool HasWebRequestScheme(const GURL& url) { | 140 bool HasWebRequestScheme(const GURL& url) { |
141 return (url.SchemeIs(chrome::kAboutScheme) || | 141 return (url.SchemeIs(chrome::kAboutScheme) || |
142 url.SchemeIs(chrome::kFileScheme) || | 142 url.SchemeIs(chrome::kFileScheme) || |
| 143 url.SchemeIs(chrome::kFileSystemScheme) || |
143 url.SchemeIs(chrome::kFtpScheme) || | 144 url.SchemeIs(chrome::kFtpScheme) || |
144 url.SchemeIs(chrome::kHttpScheme) || | 145 url.SchemeIs(chrome::kHttpScheme) || |
145 url.SchemeIs(chrome::kHttpsScheme) || | 146 url.SchemeIs(chrome::kHttpsScheme) || |
146 url.SchemeIs(chrome::kExtensionScheme)); | 147 url.SchemeIs(chrome::kExtensionScheme)); |
147 } | 148 } |
148 | 149 |
149 bool CanExtensionAccessURL(const Extension* extension, const GURL& url) { | 150 bool CanExtensionAccessURL(const Extension* extension, const GURL& url) { |
150 // about: URLs are not covered in host permissions, but are allowed anyway. | 151 // about: URLs are not covered in host permissions, but are allowed anyway. |
151 return (url.SchemeIs(chrome::kAboutScheme) || | 152 return (url.SchemeIs(chrome::kAboutScheme) || |
152 extension->HasHostPermission(url) || | 153 extension->HasHostPermission(url) || |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1723 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
1723 adblock = true; | 1724 adblock = true; |
1724 } else { | 1725 } else { |
1725 other = true; | 1726 other = true; |
1726 } | 1727 } |
1727 } | 1728 } |
1728 } | 1729 } |
1729 | 1730 |
1730 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1731 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
1731 } | 1732 } |
OLD | NEW |