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 <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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 DCHECK_NE(ALL_PERMISSIONS, permissions_type); | 607 DCHECK_NE(ALL_PERMISSIONS, permissions_type); |
608 return permissions_type == REGULAR_PERMISSIONS ? prompt_permissions_ | 608 return permissions_type == REGULAR_PERMISSIONS ? prompt_permissions_ |
609 : withheld_prompt_permissions_; | 609 : withheld_prompt_permissions_; |
610 } | 610 } |
611 | 611 |
612 bool ExtensionInstallPrompt::Prompt::ShouldDisplayRevokeFilesButton() const { | 612 bool ExtensionInstallPrompt::Prompt::ShouldDisplayRevokeFilesButton() const { |
613 return !retained_files_.empty(); | 613 return !retained_files_.empty(); |
614 } | 614 } |
615 | 615 |
616 ExtensionInstallPrompt::ShowParams::ShowParams(content::WebContents* contents) | 616 ExtensionInstallPrompt::ShowParams::ShowParams(content::WebContents* contents) |
617 : parent_web_contents(contents), | 617 : profile(ProfileForWebContents(contents)), |
618 parent_window(NativeWindowForWebContents(contents)), | 618 parent_web_contents(contents), |
619 navigator(contents) { | 619 parent_window(NativeWindowForWebContents(contents)) { |
620 } | 620 } |
621 | 621 |
622 ExtensionInstallPrompt::ShowParams::ShowParams( | 622 ExtensionInstallPrompt::ShowParams::ShowParams(Profile* profile, |
623 gfx::NativeWindow window, | 623 gfx::NativeWindow window) |
624 content::PageNavigator* navigator) | 624 : profile(profile), |
625 : parent_web_contents(NULL), | 625 parent_web_contents(NULL), |
626 parent_window(window), | 626 parent_window(window) { |
627 navigator(navigator) { | |
628 } | 627 } |
629 | 628 |
630 // static | 629 // static |
631 scoped_refptr<Extension> | 630 scoped_refptr<Extension> |
632 ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( | 631 ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( |
633 const base::DictionaryValue* manifest, | 632 const base::DictionaryValue* manifest, |
634 int flags, | 633 int flags, |
635 const std::string& id, | 634 const std::string& id, |
636 const std::string& localized_name, | 635 const std::string& localized_name, |
637 const std::string& localized_description, | 636 const std::string& localized_description, |
(...skipping 24 matching lines...) Expand all Loading... |
662 : profile_(ProfileForWebContents(contents)), | 661 : profile_(ProfileForWebContents(contents)), |
663 ui_loop_(base::MessageLoop::current()), | 662 ui_loop_(base::MessageLoop::current()), |
664 extension_(NULL), | 663 extension_(NULL), |
665 bundle_(NULL), | 664 bundle_(NULL), |
666 install_ui_(extensions::CreateExtensionInstallUI( | 665 install_ui_(extensions::CreateExtensionInstallUI( |
667 ProfileForWebContents(contents))), | 666 ProfileForWebContents(contents))), |
668 show_params_(contents), | 667 show_params_(contents), |
669 delegate_(NULL) { | 668 delegate_(NULL) { |
670 } | 669 } |
671 | 670 |
672 ExtensionInstallPrompt::ExtensionInstallPrompt( | 671 ExtensionInstallPrompt::ExtensionInstallPrompt(Profile* profile, |
673 Profile* profile, | 672 gfx::NativeWindow native_window) |
674 gfx::NativeWindow native_window, | |
675 content::PageNavigator* navigator) | |
676 : profile_(profile), | 673 : profile_(profile), |
677 ui_loop_(base::MessageLoop::current()), | 674 ui_loop_(base::MessageLoop::current()), |
678 extension_(NULL), | 675 extension_(NULL), |
679 bundle_(NULL), | 676 bundle_(NULL), |
680 install_ui_(extensions::CreateExtensionInstallUI(profile)), | 677 install_ui_(extensions::CreateExtensionInstallUI(profile)), |
681 show_params_(native_window, navigator), | 678 show_params_(profile, native_window), |
682 delegate_(NULL) { | 679 delegate_(NULL) { |
683 } | 680 } |
684 | 681 |
685 ExtensionInstallPrompt::~ExtensionInstallPrompt() { | 682 ExtensionInstallPrompt::~ExtensionInstallPrompt() { |
686 } | 683 } |
687 | 684 |
688 void ExtensionInstallPrompt::ConfirmBundleInstall( | 685 void ExtensionInstallPrompt::ConfirmBundleInstall( |
689 extensions::BundleInstaller* bundle, | 686 extensions::BundleInstaller* bundle, |
690 const PermissionSet* permissions) { | 687 const PermissionSet* permissions) { |
691 DCHECK(ui_loop_ == base::MessageLoop::current()); | 688 DCHECK(ui_loop_ == base::MessageLoop::current()); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 } | 943 } |
947 | 944 |
948 if (AutoConfirmPrompt(delegate_)) | 945 if (AutoConfirmPrompt(delegate_)) |
949 return; | 946 return; |
950 | 947 |
951 if (show_dialog_callback_.is_null()) | 948 if (show_dialog_callback_.is_null()) |
952 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); | 949 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
953 else | 950 else |
954 show_dialog_callback_.Run(show_params_, delegate_, prompt_); | 951 show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
955 } | 952 } |
OLD | NEW |