OLD | NEW |
1 // Copyright (c) 2009 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_action_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_action_context_menu_model.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/extension_tabs_module.h" | 10 #include "chrome/browser/extensions/extension_tabs_module.h" |
11 #include "chrome/browser/extensions/extensions_service.h" | 11 #include "chrome/browser/extensions/extensions_service.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(!extension_->options_url().is_empty()); | 103 DCHECK(!extension_->options_url().is_empty()); |
104 profile->GetExtensionProcessManager()->OpenOptionsPage(extension_, | 104 profile->GetExtensionProcessManager()->OpenOptionsPage(extension_, |
105 browser); | 105 browser); |
106 break; | 106 break; |
107 case DISABLE: { | 107 case DISABLE: { |
108 ExtensionsService* extension_service = profile->GetExtensionsService(); | 108 ExtensionsService* extension_service = profile->GetExtensionsService(); |
109 extension_service->DisableExtension(extension_->id()); | 109 extension_service->DisableExtension(extension_->id()); |
110 break; | 110 break; |
111 } | 111 } |
112 case UNINSTALL: { | 112 case UNINSTALL: { |
113 scoped_ptr<SkBitmap> uninstall_icon; | 113 install_ui_.reset(new ExtensionInstallUI(profile)); |
114 Extension::DecodeIcon(extension_, Extension::EXTENSION_ICON_LARGE, | 114 install_ui_->ConfirmUninstall(this, extension_); |
115 &uninstall_icon); | |
116 | |
117 ExtensionInstallUI client(profile); | |
118 client.ConfirmUninstall(this, extension_, uninstall_icon.get()); | |
119 break; | 115 break; |
120 } | 116 } |
121 case MANAGE: { | 117 case MANAGE: { |
122 browser->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), | 118 browser->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), |
123 SINGLETON_TAB, PageTransition::LINK); | 119 SINGLETON_TAB, PageTransition::LINK); |
124 break; | 120 break; |
125 } | 121 } |
126 case INSPECT_POPUP: { | 122 case INSPECT_POPUP: { |
127 if (delegate_) | 123 if (delegate_) |
128 delegate_->ShowPopupForDevToolsWindow(extension_, extension_action_); | 124 delegate_->ShowPopupForDevToolsWindow(extension_, extension_action_); |
129 break; | 125 break; |
130 } | 126 } |
131 default: | 127 default: |
132 NOTREACHED() << "Unknown option"; | 128 NOTREACHED() << "Unknown option"; |
133 break; | 129 break; |
134 } | 130 } |
135 } | 131 } |
136 | 132 |
137 void ExtensionActionContextMenuModel::InstallUIProceed(bool create_app) { | 133 void ExtensionActionContextMenuModel::InstallUIProceed(bool create_app) { |
138 DCHECK(!create_app); | 134 DCHECK(!create_app); |
139 | 135 |
140 // TODO(finnur): GetLastActive returns NULL in unit tests. | 136 // TODO(finnur): GetLastActive returns NULL in unit tests. |
141 Browser* browser = BrowserList::GetLastActive(); | 137 Browser* browser = BrowserList::GetLastActive(); |
142 std::string id = extension_->id(); | 138 std::string id = extension_->id(); |
143 browser->profile()->GetExtensionsService()->UninstallExtension(id, false); | 139 browser->profile()->GetExtensionsService()->UninstallExtension(id, false); |
144 } | 140 } |
OLD | NEW |