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