| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_disabled_infobar_delegate.h" | 5 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const Extension* extension) | 29 const Extension* extension) |
| 30 : service_(service), extension_(extension) { | 30 : service_(service), extension_(extension) { |
| 31 AddRef(); // Balanced in Proceed or Abort. | 31 AddRef(); // Balanced in Proceed or Abort. |
| 32 | 32 |
| 33 install_ui_.reset(new ExtensionInstallUI(profile)); | 33 install_ui_.reset(new ExtensionInstallUI(profile)); |
| 34 install_ui_->ConfirmInstall(this, extension_); | 34 install_ui_->ConfirmInstall(this, extension_); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Overridden from ExtensionInstallUI::Delegate: | 37 // Overridden from ExtensionInstallUI::Delegate: |
| 38 virtual void InstallUIProceed() { | 38 virtual void InstallUIProceed() { |
| 39 ExtensionPrefs* prefs = service_->extension_prefs(); | 39 service_->GrantPermissionsAndEnableExtension(extension_); |
| 40 prefs->SetDidExtensionEscalatePermissions(extension_, false); | |
| 41 service_->EnableExtension(extension_->id()); | |
| 42 Release(); | 40 Release(); |
| 43 } | 41 } |
| 44 virtual void InstallUIAbort() { | 42 virtual void InstallUIAbort() { |
| 45 // Do nothing. The extension will remain disabled. | 43 // Do nothing. The extension will remain disabled. |
| 46 Release(); | 44 Release(); |
| 47 } | 45 } |
| 48 | 46 |
| 49 private: | 47 private: |
| 50 friend class base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate>; | 48 friend class base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate>; |
| 51 | 49 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 138 |
| 141 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( | 139 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( |
| 142 tab_contents, service, extension)); | 140 tab_contents, service, extension)); |
| 143 } | 141 } |
| 144 | 142 |
| 145 void ShowExtensionDisabledDialog(ExtensionsService* service, Profile* profile, | 143 void ShowExtensionDisabledDialog(ExtensionsService* service, Profile* profile, |
| 146 const Extension* extension) { | 144 const Extension* extension) { |
| 147 // This object manages its own lifetime. | 145 // This object manages its own lifetime. |
| 148 new ExtensionDisabledDialogDelegate(profile, service, extension); | 146 new ExtensionDisabledDialogDelegate(profile, service, extension); |
| 149 } | 147 } |
| OLD | NEW |