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 "chrome/browser/extensions/api/permissions/permissions_api.h" | 5 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" | 8 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/permissions_updater.h" | 10 #include "chrome/browser/extensions/permissions_updater.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 scoped_ptr<Request::Params> params(Request::Params::Create(*args_)); | 151 scoped_ptr<Request::Params> params(Request::Params::Create(*args_)); |
152 EXTENSION_FUNCTION_VALIDATE(params.get()); | 152 EXTENSION_FUNCTION_VALIDATE(params.get()); |
153 | 153 |
154 requested_permissions_ = | 154 requested_permissions_ = |
155 helpers::UnpackPermissionSet(params->permissions, &error_); | 155 helpers::UnpackPermissionSet(params->permissions, &error_); |
156 if (!requested_permissions_.get()) | 156 if (!requested_permissions_.get()) |
157 return false; | 157 return false; |
158 | 158 |
159 PermissionsInfo* info = PermissionsInfo::GetInstance(); | 159 PermissionsInfo* info = PermissionsInfo::GetInstance(); |
160 ExtensionPrefs* prefs = profile()->GetExtensionService()->extension_prefs(); | 160 extensions::ExtensionPrefs* prefs = |
| 161 profile()->GetExtensionService()->extension_prefs(); |
161 | 162 |
162 // Make sure they're only requesting permissions supported by this API. | 163 // Make sure they're only requesting permissions supported by this API. |
163 APIPermissionSet apis = requested_permissions_->apis(); | 164 APIPermissionSet apis = requested_permissions_->apis(); |
164 for (APIPermissionSet::const_iterator i = apis.begin(); | 165 for (APIPermissionSet::const_iterator i = apis.begin(); |
165 i != apis.end(); ++i) { | 166 i != apis.end(); ++i) { |
166 const APIPermission* api = info->GetByID(*i); | 167 const APIPermission* api = info->GetByID(*i); |
167 if (!api->supports_optional()) { | 168 if (!api->supports_optional()) { |
168 error_ = ExtensionErrorUtils::FormatErrorMessage( | 169 error_ = ExtensionErrorUtils::FormatErrorMessage( |
169 kNotWhitelistedError, api->name()); | 170 kNotWhitelistedError, api->name()); |
170 return false; | 171 return false; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } else { | 210 } else { |
210 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); | 211 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); |
211 install_ui_.reset( | 212 install_ui_.reset( |
212 chrome::CreateExtensionInstallPromptWithBrowser(GetCurrentBrowser())); | 213 chrome::CreateExtensionInstallPromptWithBrowser(GetCurrentBrowser())); |
213 install_ui_->ConfirmPermissions( | 214 install_ui_->ConfirmPermissions( |
214 this, GetExtension(), requested_permissions_.get()); | 215 this, GetExtension(), requested_permissions_.get()); |
215 } | 216 } |
216 | 217 |
217 return true; | 218 return true; |
218 } | 219 } |
OLD | NEW |