Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 816223008: Update UI for WebStore bundle installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bundles_api
Patch Set: style fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 show_params_( 658 show_params_(
659 new ExtensionInstallPromptShowParams(profile, native_window)), 659 new ExtensionInstallPromptShowParams(profile, native_window)),
660 delegate_(NULL) { 660 delegate_(NULL) {
661 } 661 }
662 662
663 ExtensionInstallPrompt::~ExtensionInstallPrompt() { 663 ExtensionInstallPrompt::~ExtensionInstallPrompt() {
664 } 664 }
665 665
666 void ExtensionInstallPrompt::ConfirmBundleInstall( 666 void ExtensionInstallPrompt::ConfirmBundleInstall(
667 extensions::BundleInstaller* bundle, 667 extensions::BundleInstaller* bundle,
668 const SkBitmap* icon,
668 const PermissionSet* permissions) { 669 const PermissionSet* permissions) {
669 DCHECK(ui_loop_ == base::MessageLoop::current()); 670 DCHECK(ui_loop_ == base::MessageLoop::current());
670 bundle_ = bundle; 671 bundle_ = bundle;
671 custom_permissions_ = permissions; 672 custom_permissions_ = permissions;
672 delegate_ = bundle; 673 delegate_ = bundle;
673 prompt_ = new Prompt(BUNDLE_INSTALL_PROMPT); 674 prompt_ = new Prompt(BUNDLE_INSTALL_PROMPT);
674 675
676 SetIcon(icon);
675 ShowConfirmation(); 677 ShowConfirmation();
676 } 678 }
677 679
678 void ExtensionInstallPrompt::ConfirmStandaloneInstall( 680 void ExtensionInstallPrompt::ConfirmStandaloneInstall(
679 Delegate* delegate, 681 Delegate* delegate,
680 const Extension* extension, 682 const Extension* extension,
681 SkBitmap* icon, 683 SkBitmap* icon,
682 scoped_refptr<Prompt> prompt) { 684 scoped_refptr<Prompt> prompt) {
683 DCHECK(ui_loop_ == base::MessageLoop::current()); 685 DCHECK(ui_loop_ == base::MessageLoop::current());
684 extension_ = extension; 686 extension_ = extension;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 826
825 void ExtensionInstallPrompt::SetIcon(const SkBitmap* image) { 827 void ExtensionInstallPrompt::SetIcon(const SkBitmap* image) {
826 if (image) 828 if (image)
827 icon_ = *image; 829 icon_ = *image;
828 else 830 else
829 icon_ = SkBitmap(); 831 icon_ = SkBitmap();
830 if (icon_.empty()) { 832 if (icon_.empty()) {
831 // Let's set default icon bitmap whose size is equal to the default icon's 833 // Let's set default icon bitmap whose size is equal to the default icon's
832 // pixel size under maximal supported scale factor. If the bitmap is larger 834 // pixel size under maximal supported scale factor. If the bitmap is larger
833 // than the one we need, it will be scaled down by the ui code. 835 // than the one we need, it will be scaled down by the ui code.
834 icon_ = GetDefaultIconBitmapForMaxScaleFactor(extension_->is_app()); 836 icon_ = GetDefaultIconBitmapForMaxScaleFactor(
837 extension_ ? extension_->is_app() : false);
835 } 838 }
836 } 839 }
837 840
838 void ExtensionInstallPrompt::OnImageLoaded(const gfx::Image& image) { 841 void ExtensionInstallPrompt::OnImageLoaded(const gfx::Image& image) {
839 SetIcon(image.IsEmpty() ? NULL : image.ToSkBitmap()); 842 SetIcon(image.IsEmpty() ? NULL : image.ToSkBitmap());
840 ShowConfirmation(); 843 ShowConfirmation();
841 } 844 }
842 845
843 void ExtensionInstallPrompt::LoadImageIfNeeded() { 846 void ExtensionInstallPrompt::LoadImageIfNeeded() {
844 // Bundle install prompts do not have an icon. 847 // Bundle install prompts do not have an icon.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 case RE_ENABLE_PROMPT: 922 case RE_ENABLE_PROMPT:
920 case INLINE_INSTALL_PROMPT: 923 case INLINE_INSTALL_PROMPT:
921 case EXTERNAL_INSTALL_PROMPT: 924 case EXTERNAL_INSTALL_PROMPT:
922 case INSTALL_PROMPT: 925 case INSTALL_PROMPT:
923 case LAUNCH_PROMPT: 926 case LAUNCH_PROMPT:
924 case POST_INSTALL_PERMISSIONS_PROMPT: 927 case POST_INSTALL_PERMISSIONS_PROMPT:
925 case REMOTE_INSTALL_PROMPT: 928 case REMOTE_INSTALL_PROMPT:
926 case REPAIR_PROMPT: 929 case REPAIR_PROMPT:
927 case DELEGATED_PERMISSIONS_PROMPT: { 930 case DELEGATED_PERMISSIONS_PROMPT: {
928 prompt_->set_extension(extension_); 931 prompt_->set_extension(extension_);
929 prompt_->set_icon(gfx::Image::CreateFrom1xBitmap(icon_));
930 prompt_->set_delegated_username(delegated_username_); 932 prompt_->set_delegated_username(delegated_username_);
931 break; 933 break;
932 } 934 }
933 case BUNDLE_INSTALL_PROMPT: { 935 case BUNDLE_INSTALL_PROMPT: {
934 prompt_->set_bundle(bundle_); 936 prompt_->set_bundle(bundle_);
935 break; 937 break;
936 } 938 }
937 default: 939 default:
938 NOTREACHED() << "Unknown message"; 940 NOTREACHED() << "Unknown message";
939 return; 941 return;
940 } 942 }
943 prompt_->set_icon(gfx::Image::CreateFrom1xBitmap(icon_));
941 944
942 g_last_prompt_type_for_tests = prompt_->type(); 945 g_last_prompt_type_for_tests = prompt_->type();
943 946
944 if (AutoConfirmPrompt(delegate_)) 947 if (AutoConfirmPrompt(delegate_))
945 return; 948 return;
946 949
947 if (show_params_->WasParentDestroyed()) { 950 if (show_params_->WasParentDestroyed()) {
948 delegate_->InstallUIAbort(false); 951 delegate_->InstallUIAbort(false);
949 return; 952 return;
950 } 953 }
951 954
952 if (show_dialog_callback_.is_null()) 955 if (show_dialog_callback_.is_null())
953 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); 956 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_);
954 else 957 else
955 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); 958 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_);
956 } 959 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.h ('k') | chrome/browser/ui/cocoa/extensions/bundle_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698