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 "extensions/browser/api/web_request/web_request_permissions.h" | 5 #include "extensions/browser/api/web_request/web_request_permissions.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chromeos/login/login_state.h" | 10 #include "chromeos/login/login_state.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 using extensions::PermissionsData; | 24 using extensions::PermissionsData; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Returns true if the scheme is one we want to allow extensions to have access | 28 // Returns true if the scheme is one we want to allow extensions to have access |
29 // to. Extensions still need specific permissions for a given URL, which is | 29 // to. Extensions still need specific permissions for a given URL, which is |
30 // covered by CanExtensionAccessURL. | 30 // covered by CanExtensionAccessURL. |
31 bool HasWebRequestScheme(const GURL& url) { | 31 bool HasWebRequestScheme(const GURL& url) { |
32 return (url.SchemeIs(url::kAboutScheme) || url.SchemeIs(url::kFileScheme) || | 32 return (url.SchemeIs(url::kAboutScheme) || url.SchemeIs(url::kFileScheme) || |
33 url.SchemeIs(url::kFileSystemScheme) || | 33 url.SchemeIs(url::kFileSystemScheme) || |
34 url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kHttpScheme) || | 34 url.SchemeIs(url::kFtpScheme) || url.SchemeIsHTTPOrHTTPS() || |
35 url.SchemeIs(url::kHttpsScheme) || | 35 url.SchemeIs(extensions::kExtensionScheme) || url.SchemeIsWSOrWSS()); |
36 url.SchemeIs(extensions::kExtensionScheme)); | |
37 } | 36 } |
38 | 37 |
39 bool g_allow_all_extension_locations_in_public_session = false; | 38 bool g_allow_all_extension_locations_in_public_session = false; |
40 | 39 |
41 } // namespace | 40 } // namespace |
42 | 41 |
43 // Returns true if the URL is sensitive and requests to this URL must not be | 42 // Returns true if the URL is sensitive and requests to this URL must not be |
44 // modified/canceled by extensions, e.g. because it is targeted to the webstore | 43 // modified/canceled by extensions, e.g. because it is targeted to the webstore |
45 // to check for updates, extension blacklisting, etc. | 44 // to check for updates, extension blacklisting, etc. |
46 bool IsSensitiveURL(const GURL& url) { | 45 bool IsSensitiveURL(const GURL& url) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 break; | 166 break; |
168 case REQUIRE_ALL_URLS: | 167 case REQUIRE_ALL_URLS: |
169 if (extension->permissions_data()->HasEffectiveAccessToAllHosts()) | 168 if (extension->permissions_data()->HasEffectiveAccessToAllHosts()) |
170 access = PermissionsData::ACCESS_ALLOWED; | 169 access = PermissionsData::ACCESS_ALLOWED; |
171 // else ACCESS_DENIED | 170 // else ACCESS_DENIED |
172 break; | 171 break; |
173 } | 172 } |
174 | 173 |
175 return access; | 174 return access; |
176 } | 175 } |
OLD | NEW |