| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_tabs_module.h" | 9 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ExtensionService* extension_service = profile_->GetExtensionService(); | 120 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 121 extension_service->SetBrowserActionVisibility(extension, false); | 121 extension_service->SetBrowserActionVisibility(extension, false); |
| 122 break; | 122 break; |
| 123 } | 123 } |
| 124 case DISABLE: { | 124 case DISABLE: { |
| 125 ExtensionService* extension_service = profile_->GetExtensionService(); | 125 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 126 extension_service->DisableExtension(extension_id_); | 126 extension_service->DisableExtension(extension_id_); |
| 127 break; | 127 break; |
| 128 } | 128 } |
| 129 case UNINSTALL: { | 129 case UNINSTALL: { |
| 130 AddRef(); // Balanced in InstallUIProceed and InstallUIAbort. | 130 AddRef(); // Balanced in Accepted() and Canceled() |
| 131 install_ui_.reset(new ExtensionInstallUI(profile_)); | 131 extension_generic_dialog_.reset(new ExtensionGenericDialog(profile_)); |
| 132 install_ui_->ConfirmUninstall(this, extension); | 132 extension_generic_dialog_->ConfirmUninstall(this, extension); |
| 133 break; | 133 break; |
| 134 } | 134 } |
| 135 case MANAGE: { | 135 case MANAGE: { |
| 136 browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), | 136 browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), |
| 137 SINGLETON_TAB, PageTransition::LINK); | 137 SINGLETON_TAB, PageTransition::LINK); |
| 138 break; | 138 break; |
| 139 } | 139 } |
| 140 case INSPECT_POPUP: { | 140 case INSPECT_POPUP: { |
| 141 delegate_->InspectPopup(extension_action_); | 141 delegate_->InspectPopup(extension_action_); |
| 142 break; | 142 break; |
| 143 } | 143 } |
| 144 default: | 144 default: |
| 145 NOTREACHED() << "Unknown option"; | 145 NOTREACHED() << "Unknown option"; |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ExtensionContextMenuModel::InstallUIProceed() { | 150 void ExtensionContextMenuModel::ExtensionDialogAccepted() { |
| 151 if (GetExtension()) | 151 if (GetExtension()) |
| 152 profile_->GetExtensionService()->UninstallExtension(extension_id_, false); | 152 profile_->GetExtensionService()->UninstallExtension(extension_id_, false); |
| 153 | 153 |
| 154 Release(); | 154 Release(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ExtensionContextMenuModel::InstallUIAbort() { | 157 void ExtensionContextMenuModel::ExtensionDialogCanceled() { |
| 158 Release(); | 158 Release(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 const Extension* ExtensionContextMenuModel::GetExtension() const { | 161 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 162 ExtensionService* extension_service = profile_->GetExtensionService(); | 162 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 163 return extension_service->GetExtensionById(extension_id_, false); | 163 return extension_service->GetExtensionById(extension_id_, false); |
| 164 } | 164 } |
| OLD | NEW |