Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_permissions.cc

Issue 191293009: Cleanup: Move kAboutScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_permissions.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/extension_renderer_state.h" 9 #include "chrome/browser/extensions/extension_renderer_state.h"
10 #include "chrome/common/extensions/extension_constants.h" 10 #include "chrome/common/extensions/extension_constants.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 GURL url_without_query = url.ReplaceComponents(replacements); 61 GURL url_without_query = url.ReplaceComponents(replacements);
62 return sensitive_chrome_url || 62 return sensitive_chrome_url ||
63 extension_urls::IsWebstoreUpdateUrl(url_without_query) || 63 extension_urls::IsWebstoreUpdateUrl(url_without_query) ||
64 extension_urls::IsBlacklistUpdateUrl(url); 64 extension_urls::IsBlacklistUpdateUrl(url);
65 } 65 }
66 66
67 // Returns true if the scheme is one we want to allow extensions to have access 67 // Returns true if the scheme is one we want to allow extensions to have access
68 // to. Extensions still need specific permissions for a given URL, which is 68 // to. Extensions still need specific permissions for a given URL, which is
69 // covered by CanExtensionAccessURL. 69 // covered by CanExtensionAccessURL.
70 bool HasWebRequestScheme(const GURL& url) { 70 bool HasWebRequestScheme(const GURL& url) {
71 return (url.SchemeIs(chrome::kAboutScheme) || 71 return (url.SchemeIs(content::kAboutScheme) ||
72 url.SchemeIs(content::kFileScheme) || 72 url.SchemeIs(content::kFileScheme) ||
73 url.SchemeIs(content::kFileSystemScheme) || 73 url.SchemeIs(content::kFileSystemScheme) ||
74 url.SchemeIs(content::kFtpScheme) || 74 url.SchemeIs(content::kFtpScheme) ||
75 url.SchemeIs(content::kHttpScheme) || 75 url.SchemeIs(content::kHttpScheme) ||
76 url.SchemeIs(content::kHttpsScheme) || 76 url.SchemeIs(content::kHttpsScheme) ||
77 url.SchemeIs(extensions::kExtensionScheme)); 77 url.SchemeIs(extensions::kExtensionScheme));
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Check if this event crosses incognito boundaries when it shouldn't. 125 // Check if this event crosses incognito boundaries when it shouldn't.
126 if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension)) 126 if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension))
127 return false; 127 return false;
128 128
129 switch (host_permissions_check) { 129 switch (host_permissions_check) {
130 case DO_NOT_CHECK_HOST: 130 case DO_NOT_CHECK_HOST:
131 break; 131 break;
132 case REQUIRE_HOST_PERMISSION: 132 case REQUIRE_HOST_PERMISSION:
133 // about: URLs are not covered in host permissions, but are allowed 133 // about: URLs are not covered in host permissions, but are allowed
134 // anyway. 134 // anyway.
135 if (!((url.SchemeIs(chrome::kAboutScheme) || 135 if (!((url.SchemeIs(content::kAboutScheme) ||
136 extensions::PermissionsData::HasHostPermission(extension, url) || 136 extensions::PermissionsData::HasHostPermission(extension, url) ||
137 url.GetOrigin() == extension->url()))) { 137 url.GetOrigin() == extension->url()))) {
138 return false; 138 return false;
139 } 139 }
140 break; 140 break;
141 case REQUIRE_ALL_URLS: 141 case REQUIRE_ALL_URLS:
142 if (!extensions::PermissionsData::HasEffectiveAccessToAllHosts(extension)) 142 if (!extensions::PermissionsData::HasEffectiveAccessToAllHosts(extension))
143 return false; 143 return false;
144 break; 144 break;
145 } 145 }
146 146
147 return true; 147 return true;
148 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_unittest.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698