| 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_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/permissions_updater.h" | 10 #include "chrome/browser/extensions/permissions_updater.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Filter out the granted permissions so we only prompt for new ones. | 205 // Filter out the granted permissions so we only prompt for new ones. |
| 206 requested_permissions_ = PermissionSet::CreateDifference( | 206 requested_permissions_ = PermissionSet::CreateDifference( |
| 207 requested_permissions_.get(), granted.get()); | 207 requested_permissions_.get(), granted.get()); |
| 208 | 208 |
| 209 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). | 209 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). |
| 210 | 210 |
| 211 // We don't need to show the prompt if there are no new warnings, or if | 211 // We don't need to show the prompt if there are no new warnings, or if |
| 212 // we're skipping the confirmation UI. All extension types but INTERNAL | 212 // we're skipping the confirmation UI. All extension types but INTERNAL |
| 213 // are allowed to silently increase their permission level. | 213 // are allowed to silently increase their permission level. |
| 214 bool has_no_warnings = requested_permissions_->GetWarningMessages( | 214 bool has_no_warnings = requested_permissions_->GetWarningMessages( |
| 215 GetExtension()->GetType()).empty(); | 215 GetExtension()->GetType(), false).empty(); |
| 216 if (auto_confirm_for_tests == PROCEED || has_no_warnings || | 216 if (auto_confirm_for_tests == PROCEED || has_no_warnings || |
| 217 extension_->location() == Manifest::COMPONENT) { | 217 extension_->location() == Manifest::COMPONENT) { |
| 218 InstallUIProceed(); | 218 InstallUIProceed(); |
| 219 } else if (auto_confirm_for_tests == ABORT) { | 219 } else if (auto_confirm_for_tests == ABORT) { |
| 220 // Pretend the user clicked cancel. | 220 // Pretend the user clicked cancel. |
| 221 InstallUIAbort(true); | 221 InstallUIAbort(true); |
| 222 } else { | 222 } else { |
| 223 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); | 223 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); |
| 224 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); | 224 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); |
| 225 install_ui_->ConfirmPermissions( | 225 install_ui_->ConfirmPermissions( |
| 226 this, GetExtension(), requested_permissions_.get()); | 226 this, GetExtension(), requested_permissions_.get()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 return true; | 229 return true; |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace extensions | 232 } // namespace extensions |
| OLD | NEW |