| 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/ui/extensions/extension_enable_flow.h" | 5 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Supervised users can't re-enable custodian-installed extensions. | 94 // Supervised users can't re-enable custodian-installed extensions. |
| 95 if (extensions::util::IsExtensionSupervised(extension, profile_)) { | 95 if (extensions::util::IsExtensionSupervised(extension, profile_)) { |
| 96 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us. | 96 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us. |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (profiles::IsProfileLocked(profile_->GetPath())) { | 100 if (profiles::IsProfileLocked(profile_->GetPath())) { |
| 101 UserManager::Show(base::FilePath(), | 101 UserManager::Show(base::FilePath(), |
| 102 profiles::USER_MANAGER_NO_TUTORIAL, | |
| 103 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER); | 102 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER); |
| 104 return; | 103 return; |
| 105 } | 104 } |
| 106 | 105 |
| 107 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); | 106 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
| 108 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) { | 107 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) { |
| 109 // Enable the extension immediately if its privileges weren't escalated. | 108 // Enable the extension immediately if its privileges weren't escalated. |
| 110 // This is a no-op if the extension was previously terminated. | 109 // This is a no-op if the extension was previously terminated. |
| 111 service->EnableExtension(extension_id_); | 110 service->EnableExtension(extension_id_); |
| 112 | 111 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 187 } |
| 189 | 188 |
| 190 service->GrantPermissionsAndEnableExtension(extension); | 189 service->GrantPermissionsAndEnableExtension(extension); |
| 191 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. | 190 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. |
| 192 } else { | 191 } else { |
| 193 delegate_->ExtensionEnableFlowAborted( | 192 delegate_->ExtensionEnableFlowAborted( |
| 194 result == ExtensionInstallPrompt::Result::USER_CANCELED); | 193 result == ExtensionInstallPrompt::Result::USER_CANCELED); |
| 195 // |delegate_| may delete us. | 194 // |delegate_| may delete us. |
| 196 } | 195 } |
| 197 } | 196 } |
| OLD | NEW |