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

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 10213002: Make downloads.download() respect host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 7 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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3224 return runtime_data_.GetActivePermissions()->effective_hosts(); 3224 return runtime_data_.GetActivePermissions()->effective_hosts();
3225 } 3225 }
3226 3226
3227 bool Extension::HasHostPermission(const GURL& url) const { 3227 bool Extension::HasHostPermission(const GURL& url) const {
3228 if (url.SchemeIs(chrome::kChromeUIScheme) && 3228 if (url.SchemeIs(chrome::kChromeUIScheme) &&
3229 url.host() != chrome::kChromeUIFaviconHost && 3229 url.host() != chrome::kChromeUIFaviconHost &&
3230 url.host() != chrome::kChromeUIThumbnailHost && 3230 url.host() != chrome::kChromeUIThumbnailHost &&
3231 location() != Extension::COMPONENT) { 3231 location() != Extension::COMPONENT) {
3232 return false; 3232 return false;
3233 } 3233 }
3234 if (url.SchemeIs(chrome::kExtensionScheme) &&
Aaron Boodman 2012/05/09 05:32:38 I think you can replace this entire new hunk with:
Aaron Boodman 2012/05/09 18:28:44 If this check were not here, are there multiple pl
benjhayden 2012/05/09 21:36:42 download() is the only function that will accept a
3235 url.host() == id()) {
3236 return true;
3237 }
3238 if (url.inner_url() != NULL &&
3239 url.inner_url()->is_valid() &&
3240 url.SchemeIsFileSystem() &&
3241 url.inner_url()->SchemeIs(chrome::kExtensionScheme) &&
3242 url.inner_url()->host() == id()) {
3243 return true;
3244 }
3234 3245
3235 base::AutoLock auto_lock(runtime_data_lock_); 3246 base::AutoLock auto_lock(runtime_data_lock_);
3236 return runtime_data_.GetActivePermissions()-> 3247 return runtime_data_.GetActivePermissions()->
3237 HasExplicitAccessToOrigin(url); 3248 HasExplicitAccessToOrigin(url);
3238 } 3249 }
3239 3250
3240 bool Extension::HasEffectiveAccessToAllHosts() const { 3251 bool Extension::HasEffectiveAccessToAllHosts() const {
3241 base::AutoLock auto_lock(runtime_data_lock_); 3252 base::AutoLock auto_lock(runtime_data_lock_);
3242 return runtime_data_.GetActivePermissions()->HasEffectiveAccessToAllHosts(); 3253 return runtime_data_.GetActivePermissions()->HasEffectiveAccessToAllHosts();
3243 } 3254 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3544 already_disabled(false), 3555 already_disabled(false),
3545 extension(extension) {} 3556 extension(extension) {}
3546 3557
3547 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3558 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3548 const Extension* extension, 3559 const Extension* extension,
3549 const ExtensionPermissionSet* permissions, 3560 const ExtensionPermissionSet* permissions,
3550 Reason reason) 3561 Reason reason)
3551 : reason(reason), 3562 : reason(reason),
3552 extension(extension), 3563 extension(extension),
3553 permissions(permissions) {} 3564 permissions(permissions) {}
OLDNEW
« no previous file with comments | « chrome/browser/download/download_extension_api.cc ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698