OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ui.h" | 5 #include "chrome/browser/extensions/extension_disabled_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 string16 ExtensionDisabledGlobalError::GetBubbleViewCancelButtonLabel() { | 255 string16 ExtensionDisabledGlobalError::GetBubbleViewCancelButtonLabel() { |
256 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL); | 256 return l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL); |
257 } | 257 } |
258 | 258 |
259 void ExtensionDisabledGlobalError::OnBubbleViewDidClose(Browser* browser) { | 259 void ExtensionDisabledGlobalError::OnBubbleViewDidClose(Browser* browser) { |
260 } | 260 } |
261 | 261 |
262 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( | 262 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( |
263 Browser* browser) { | 263 Browser* browser) { |
264 // Delay extension reenabling so this bubble closes properly. | 264 // Delay extension reenabling so this bubble closes properly. |
265 MessageLoop::current()->PostTask(FROM_HERE, | 265 base::MessageLoop::current()->PostTask(FROM_HERE, |
266 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, | 266 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, |
267 service_->AsWeakPtr(), extension_)); | 267 service_->AsWeakPtr(), extension_)); |
268 } | 268 } |
269 | 269 |
270 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( | 270 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( |
271 Browser* browser) { | 271 Browser* browser) { |
272 #if !defined(OS_ANDROID) | 272 #if !defined(OS_ANDROID) |
273 uninstall_dialog_.reset( | 273 uninstall_dialog_.reset( |
274 ExtensionUninstallDialog::Create(service_->profile(), browser, this)); | 274 ExtensionUninstallDialog::Create(service_->profile(), browser, this)); |
275 // Delay showing the uninstall dialog, so that this function returns | 275 // Delay showing the uninstall dialog, so that this function returns |
276 // immediately, to close the bubble properly. See crbug.com/121544. | 276 // immediately, to close the bubble properly. See crbug.com/121544. |
277 MessageLoop::current()->PostTask(FROM_HERE, | 277 base::MessageLoop::current()->PostTask(FROM_HERE, |
278 base::Bind(&ExtensionUninstallDialog::ConfirmUninstall, | 278 base::Bind(&ExtensionUninstallDialog::ConfirmUninstall, |
279 uninstall_dialog_->AsWeakPtr(), extension_)); | 279 uninstall_dialog_->AsWeakPtr(), extension_)); |
280 #endif // !defined(OS_ANDROID) | 280 #endif // !defined(OS_ANDROID) |
281 } | 281 } |
282 | 282 |
283 void ExtensionDisabledGlobalError::ExtensionUninstallAccepted() { | 283 void ExtensionDisabledGlobalError::ExtensionUninstallAccepted() { |
284 service_->UninstallExtension(extension_->id(), false, NULL); | 284 service_->UninstallExtension(extension_->id(), false, NULL); |
285 } | 285 } |
286 | 286 |
287 void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() { | 287 void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 void ShowExtensionDisabledDialog(ExtensionService* service, | 328 void ShowExtensionDisabledDialog(ExtensionService* service, |
329 content::WebContents* web_contents, | 329 content::WebContents* web_contents, |
330 const Extension* extension) { | 330 const Extension* extension) { |
331 scoped_ptr<ExtensionInstallPrompt> install_ui( | 331 scoped_ptr<ExtensionInstallPrompt> install_ui( |
332 new ExtensionInstallPrompt(web_contents)); | 332 new ExtensionInstallPrompt(web_contents)); |
333 // This object manages its own lifetime. | 333 // This object manages its own lifetime. |
334 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 334 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); |
335 } | 335 } |
336 | 336 |
337 } // namespace extensions | 337 } // namespace extensions |
OLD | NEW |