| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/permissions/permissions_data.h" | 5 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (iter->id() == APIPermission::kExperimental) { | 166 if (iter->id() == APIPermission::kExperimental) { |
| 167 if (!CanSpecifyExperimentalPermission(extension)) { | 167 if (!CanSpecifyExperimentalPermission(extension)) { |
| 168 *error = ASCIIToUTF16(errors::kExperimentalFlagRequired); | 168 *error = ASCIIToUTF16(errors::kExperimentalFlagRequired); |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 api_permissions->AddImpliedPermissions(); |
| 175 |
| 174 // Remove permissions that are not available to this extension. | 176 // Remove permissions that are not available to this extension. |
| 175 for (std::vector<APIPermission::ID>::const_iterator iter = to_remove.begin(); | 177 for (std::vector<APIPermission::ID>::const_iterator iter = to_remove.begin(); |
| 176 iter != to_remove.end(); ++iter) { | 178 iter != to_remove.end(); ++iter) { |
| 177 api_permissions->erase(*iter); | 179 api_permissions->erase(*iter); |
| 178 } | 180 } |
| 179 | 181 |
| 180 // Parse host pattern permissions. | 182 // Parse host pattern permissions. |
| 181 const int kAllowedSchemes = | 183 const int kAllowedSchemes = |
| 182 PermissionsData::CanExecuteScriptEverywhere(extension) ? | 184 PermissionsData::CanExecuteScriptEverywhere(extension) ? |
| 183 URLPattern::SCHEME_ALL : Extension::kValidHostPermissionSchemes; | 185 URLPattern::SCHEME_ALL : Extension::kValidHostPermissionSchemes; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 optional_permission_set_ = new PermissionSet( | 637 optional_permission_set_ = new PermissionSet( |
| 636 initial_optional_permissions_->api_permissions, | 638 initial_optional_permissions_->api_permissions, |
| 637 initial_optional_permissions_->host_permissions, | 639 initial_optional_permissions_->host_permissions, |
| 638 URLPatternSet()); | 640 URLPatternSet()); |
| 639 | 641 |
| 640 initial_required_permissions_.reset(); | 642 initial_required_permissions_.reset(); |
| 641 initial_optional_permissions_.reset(); | 643 initial_optional_permissions_.reset(); |
| 642 } | 644 } |
| 643 | 645 |
| 644 } // namespace extensions | 646 } // namespace extensions |
| OLD | NEW |