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/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" | 9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" |
10 #include "chrome/browser/extensions/extension_management.h" | 10 #include "chrome/browser/extensions/extension_management.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 requested_permissions_.get(), | 213 requested_permissions_.get(), |
214 extension()->permissions_data()->active_permissions().get()); | 214 extension()->permissions_data()->active_permissions().get()); |
215 | 215 |
216 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). | 216 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). |
217 | 217 |
218 // We don't need to show the prompt if there are no new warnings, or if | 218 // We don't need to show the prompt if there are no new warnings, or if |
219 // we're skipping the confirmation UI. All extension types but INTERNAL | 219 // we're skipping the confirmation UI. All extension types but INTERNAL |
220 // are allowed to silently increase their permission level. | 220 // are allowed to silently increase their permission level. |
221 bool has_no_warnings = | 221 bool has_no_warnings = |
222 PermissionMessageProvider::Get() | 222 PermissionMessageProvider::Get() |
223 ->GetLegacyWarningMessages(requested_permissions_.get(), | 223 ->GetPermissionMessageStrings(requested_permissions_.get(), |
224 extension()->GetType()) | 224 extension()->GetType()) |
225 .empty(); | 225 .empty(); |
226 if (auto_confirm_for_tests == PROCEED || has_no_warnings || | 226 if (auto_confirm_for_tests == PROCEED || has_no_warnings || |
227 extension_->location() == Manifest::COMPONENT) { | 227 extension_->location() == Manifest::COMPONENT) { |
228 InstallUIProceed(); | 228 InstallUIProceed(); |
229 } else if (auto_confirm_for_tests == ABORT) { | 229 } else if (auto_confirm_for_tests == ABORT) { |
230 // Pretend the user clicked cancel. | 230 // Pretend the user clicked cancel. |
231 InstallUIAbort(true); | 231 InstallUIAbort(true); |
232 } else { | 232 } else { |
233 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); | 233 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); |
234 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); | 234 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); |
235 install_ui_->ConfirmPermissions( | 235 install_ui_->ConfirmPermissions( |
236 this, extension(), requested_permissions_.get()); | 236 this, extension(), requested_permissions_.get()); |
237 } | 237 } |
238 | 238 |
239 return true; | 239 return true; |
240 } | 240 } |
241 | 241 |
242 } // namespace extensions | 242 } // namespace extensions |
OLD | NEW |