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 <bitset> | 7 #include <bitset> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/extensions/extension_install_prompt.h" | 19 #include "chrome/browser/extensions/extension_install_prompt.h" |
20 #include "chrome/browser/extensions/extension_install_ui.h" | 20 #include "chrome/browser/extensions/extension_install_ui.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 22 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
23 #include "chrome/browser/extensions/extension_util.h" | 23 #include "chrome/browser/extensions/extension_util.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/browser_window.h" |
26 #include "chrome/browser/ui/global_error/global_error.h" | 27 #include "chrome/browser/ui/global_error/global_error.h" |
27 #include "chrome/browser/ui/global_error/global_error_service.h" | 28 #include "chrome/browser/ui/global_error/global_error_service.h" |
28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 29 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
30 #include "content/public/browser/notification_details.h" | 31 #include "content/public/browser/notification_details.h" |
31 #include "content/public/browser/notification_observer.h" | 32 #include "content/public/browser/notification_observer.h" |
32 #include "content/public/browser/notification_registrar.h" | 33 #include "content/public/browser/notification_registrar.h" |
33 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
34 #include "extensions/browser/extension_util.h" | 35 #include "extensions/browser/extension_util.h" |
35 #include "extensions/browser/image_loader.h" | 36 #include "extensions/browser/image_loader.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // Delay extension reenabling so this bubble closes properly. | 341 // Delay extension reenabling so this bubble closes properly. |
341 base::MessageLoop::current()->PostTask(FROM_HERE, | 342 base::MessageLoop::current()->PostTask(FROM_HERE, |
342 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, | 343 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, |
343 service_->AsWeakPtr(), extension_)); | 344 service_->AsWeakPtr(), extension_)); |
344 } | 345 } |
345 | 346 |
346 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( | 347 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( |
347 Browser* browser) { | 348 Browser* browser) { |
348 #if !defined(OS_ANDROID) | 349 #if !defined(OS_ANDROID) |
349 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create( | 350 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create( |
350 service_->profile(), browser, this)); | 351 service_->profile(), browser->window()->GetNativeWindow(), this)); |
351 // Delay showing the uninstall dialog, so that this function returns | 352 // Delay showing the uninstall dialog, so that this function returns |
352 // immediately, to close the bubble properly. See crbug.com/121544. | 353 // immediately, to close the bubble properly. See crbug.com/121544. |
353 base::MessageLoop::current()->PostTask( | 354 base::MessageLoop::current()->PostTask( |
354 FROM_HERE, | 355 FROM_HERE, |
355 base::Bind(&extensions::ExtensionUninstallDialog::ConfirmUninstall, | 356 base::Bind(&extensions::ExtensionUninstallDialog::ConfirmUninstall, |
356 uninstall_dialog_->AsWeakPtr(), | 357 uninstall_dialog_->AsWeakPtr(), |
357 extension_)); | 358 extension_)); |
358 #endif // !defined(OS_ANDROID) | 359 #endif // !defined(OS_ANDROID) |
359 } | 360 } |
360 | 361 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void ShowExtensionDisabledDialog(ExtensionService* service, | 437 void ShowExtensionDisabledDialog(ExtensionService* service, |
437 content::WebContents* web_contents, | 438 content::WebContents* web_contents, |
438 const Extension* extension) { | 439 const Extension* extension) { |
439 scoped_ptr<ExtensionInstallPrompt> install_ui( | 440 scoped_ptr<ExtensionInstallPrompt> install_ui( |
440 new ExtensionInstallPrompt(web_contents)); | 441 new ExtensionInstallPrompt(web_contents)); |
441 // This object manages its own lifetime. | 442 // This object manages its own lifetime. |
442 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 443 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); |
443 } | 444 } |
444 | 445 |
445 } // namespace extensions | 446 } // namespace extensions |
OLD | NEW |