| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 extension_service->SetBrowserActionVisibility(extension, false); | 124 extension_service->SetBrowserActionVisibility(extension, false); |
| 125 break; | 125 break; |
| 126 } | 126 } |
| 127 case DISABLE: { | 127 case DISABLE: { |
| 128 ExtensionService* extension_service = profile_->GetExtensionService(); | 128 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 129 extension_service->DisableExtension(extension_id_); | 129 extension_service->DisableExtension(extension_id_); |
| 130 break; | 130 break; |
| 131 } | 131 } |
| 132 case UNINSTALL: { | 132 case UNINSTALL: { |
| 133 AddRef(); // Balanced in Accepted() and Canceled() | 133 AddRef(); // Balanced in Accepted() and Canceled() |
| 134 extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile_)); | 134 extension_uninstall_ui_.reset(new ExtensionUninstallUI(profile_)); |
| 135 extension_uninstall_dialog_->ConfirmUninstall(this, extension); | 135 extension_uninstall_ui_->ConfirmUninstall(this, extension); |
| 136 break; | 136 break; |
| 137 } | 137 } |
| 138 case MANAGE: { | 138 case MANAGE: { |
| 139 browser_->ShowOptionsTab(chrome::kExtensionsSubPage); | 139 browser_->ShowOptionsTab(chrome::kExtensionsSubPage); |
| 140 break; | 140 break; |
| 141 } | 141 } |
| 142 case INSPECT_POPUP: { | 142 case INSPECT_POPUP: { |
| 143 delegate_->InspectPopup(extension_action_); | 143 delegate_->InspectPopup(extension_action_); |
| 144 break; | 144 break; |
| 145 } | 145 } |
| 146 default: | 146 default: |
| 147 NOTREACHED() << "Unknown option"; | 147 NOTREACHED() << "Unknown option"; |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ExtensionContextMenuModel::ExtensionDialogAccepted() { | 152 void ExtensionContextMenuModel::ExtensionUninstallAccepted() { |
| 153 if (GetExtension()) | 153 if (GetExtension()) |
| 154 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, | 154 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, |
| 155 NULL); | 155 NULL); |
| 156 | 156 |
| 157 Release(); | 157 Release(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ExtensionContextMenuModel::ExtensionDialogCanceled() { | 160 void ExtensionContextMenuModel::ExtensionUninstallCanceled() { |
| 161 Release(); | 161 Release(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 const Extension* ExtensionContextMenuModel::GetExtension() const { | 164 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 165 ExtensionService* extension_service = profile_->GetExtensionService(); | 165 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 166 return extension_service->GetExtensionById(extension_id_, false); | 166 return extension_service->GetExtensionById(extension_id_, false); |
| 167 } | 167 } |
| OLD | NEW |