| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Filter out the active permissions. | 211 // Filter out the active permissions. |
| 212 requested_permissions_ = PermissionSet::CreateDifference( | 212 requested_permissions_ = PermissionSet::CreateDifference( |
| 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 = PermissionMessageProvider::Get() | 221 bool has_no_warnings = |
| 222 ->GetWarningMessages(requested_permissions_.get(), | 222 PermissionMessageProvider::Get() |
| 223 extension()->GetType()) | 223 ->GetLegacyWarningMessages(requested_permissions_.get(), |
| 224 .empty(); | 224 extension()->GetType()) |
| 225 .empty(); |
| 225 if (auto_confirm_for_tests == PROCEED || has_no_warnings || | 226 if (auto_confirm_for_tests == PROCEED || has_no_warnings || |
| 226 extension_->location() == Manifest::COMPONENT) { | 227 extension_->location() == Manifest::COMPONENT) { |
| 227 InstallUIProceed(); | 228 InstallUIProceed(); |
| 228 } else if (auto_confirm_for_tests == ABORT) { | 229 } else if (auto_confirm_for_tests == ABORT) { |
| 229 // Pretend the user clicked cancel. | 230 // Pretend the user clicked cancel. |
| 230 InstallUIAbort(true); | 231 InstallUIAbort(true); |
| 231 } else { | 232 } else { |
| 232 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); | 233 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); |
| 233 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); | 234 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); |
| 234 install_ui_->ConfirmPermissions( | 235 install_ui_->ConfirmPermissions( |
| 235 this, extension(), requested_permissions_.get()); | 236 this, extension(), requested_permissions_.get()); |
| 236 } | 237 } |
| 237 | 238 |
| 238 return true; | 239 return true; |
| 239 } | 240 } |
| 240 | 241 |
| 241 } // namespace extensions | 242 } // namespace extensions |
| OLD | NEW |