| 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_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 done_callback_ = done_callback; | 660 done_callback_ = done_callback; |
| 661 if (icon && !icon->empty()) | 661 if (icon && !icon->empty()) |
| 662 SetIcon(icon); | 662 SetIcon(icon); |
| 663 prompt_ = std::move(prompt); | 663 prompt_ = std::move(prompt); |
| 664 custom_permissions_ = std::move(custom_permissions); | 664 custom_permissions_ = std::move(custom_permissions); |
| 665 show_dialog_callback_ = show_dialog_callback; | 665 show_dialog_callback_ = show_dialog_callback; |
| 666 | 666 |
| 667 // We special-case themes to not show any confirm UI. Instead they are | 667 // We special-case themes to not show any confirm UI. Instead they are |
| 668 // immediately installed, and then we show an infobar (see OnInstallSuccess) | 668 // immediately installed, and then we show an infobar (see OnInstallSuccess) |
| 669 // to allow the user to revert if they don't like it. | 669 // to allow the user to revert if they don't like it. |
| 670 // | 670 if (extension->is_theme() && extension->from_webstore()) { |
| 671 // We don't do this in the case where off-store extension installs are | 671 base::ResetAndReturn(&done_callback_).Run(Result::ACCEPTED); |
| 672 // disabled because in that case, we don't show the dangerous download UI, so | 672 return; |
| 673 // we need the UI confirmation. | |
| 674 if (extension->is_theme()) { | |
| 675 if (extension->from_webstore() || | |
| 676 extensions::FeatureSwitch::easy_off_store_install()->IsEnabled()) { | |
| 677 base::ResetAndReturn(&done_callback_).Run(Result::ACCEPTED); | |
| 678 return; | |
| 679 } | |
| 680 } | 673 } |
| 681 | 674 |
| 682 LoadImageIfNeeded(); | 675 LoadImageIfNeeded(); |
| 683 } | 676 } |
| 684 | 677 |
| 685 void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, | 678 void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, |
| 686 SkBitmap* icon) { | 679 SkBitmap* icon) { |
| 687 extension_ = extension; | 680 extension_ = extension; |
| 688 SetIcon(icon); | 681 SetIcon(icon); |
| 689 | 682 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 815 |
| 823 if (AutoConfirmPrompt(&done_callback_)) | 816 if (AutoConfirmPrompt(&done_callback_)) |
| 824 return; | 817 return; |
| 825 | 818 |
| 826 if (show_dialog_callback_.is_null()) | 819 if (show_dialog_callback_.is_null()) |
| 827 show_dialog_callback_ = GetDefaultShowDialogCallback(); | 820 show_dialog_callback_ = GetDefaultShowDialogCallback(); |
| 828 base::ResetAndReturn(&show_dialog_callback_) | 821 base::ResetAndReturn(&show_dialog_callback_) |
| 829 .Run(show_params_.get(), base::ResetAndReturn(&done_callback_), | 822 .Run(show_params_.get(), base::ResetAndReturn(&done_callback_), |
| 830 std::move(prompt_)); | 823 std::move(prompt_)); |
| 831 } | 824 } |
| OLD | NEW |