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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_dialog_.reset(new ExtensionUninstallDialog(profile_)); |
135 extension_uninstall_dialog_->ConfirmUninstall(this, extension); | 135 extension_uninstall_dialog_->ConfirmUninstall(this, extension); |
136 break; | 136 break; |
137 } | 137 } |
138 case MANAGE: { | 138 case MANAGE: { |
139 browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), | 139 browser_->ShowOptionsTab(chrome::kExtensionsSubPage); |
140 SINGLETON_TAB, PageTransition::LINK); | |
141 break; | 140 break; |
142 } | 141 } |
143 case INSPECT_POPUP: { | 142 case INSPECT_POPUP: { |
144 delegate_->InspectPopup(extension_action_); | 143 delegate_->InspectPopup(extension_action_); |
145 break; | 144 break; |
146 } | 145 } |
147 default: | 146 default: |
148 NOTREACHED() << "Unknown option"; | 147 NOTREACHED() << "Unknown option"; |
149 break; | 148 break; |
150 } | 149 } |
151 } | 150 } |
152 | 151 |
153 void ExtensionContextMenuModel::ExtensionDialogAccepted() { | 152 void ExtensionContextMenuModel::ExtensionDialogAccepted() { |
154 if (GetExtension()) | 153 if (GetExtension()) |
155 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, | 154 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, |
156 NULL); | 155 NULL); |
157 | 156 |
158 Release(); | 157 Release(); |
159 } | 158 } |
160 | 159 |
161 void ExtensionContextMenuModel::ExtensionDialogCanceled() { | 160 void ExtensionContextMenuModel::ExtensionDialogCanceled() { |
162 Release(); | 161 Release(); |
163 } | 162 } |
164 | 163 |
165 const Extension* ExtensionContextMenuModel::GetExtension() const { | 164 const Extension* ExtensionContextMenuModel::GetExtension() const { |
166 ExtensionService* extension_service = profile_->GetExtensionService(); | 165 ExtensionService* extension_service = profile_->GetExtensionService(); |
167 return extension_service->GetExtensionById(extension_id_, false); | 166 return extension_service->GetExtensionById(extension_id_, false); |
168 } | 167 } |
OLD | NEW |