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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 int ExtensionInstallPrompt::Prompt::GetDialogButtons() const { | 304 int ExtensionInstallPrompt::Prompt::GetDialogButtons() const { |
305 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT && | 305 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT && |
306 ShouldDisplayRevokeFilesButton()) { | 306 ShouldDisplayRevokeFilesButton()) { |
307 return kButtons[type_] | ui::DIALOG_BUTTON_OK; | 307 return kButtons[type_] | ui::DIALOG_BUTTON_OK; |
308 } | 308 } |
309 | 309 |
310 return kButtons[type_]; | 310 return kButtons[type_]; |
311 } | 311 } |
312 | 312 |
313 bool ExtensionInstallPrompt::Prompt::ShouldShowExplanationText() const { | 313 bool ExtensionInstallPrompt::Prompt::ShouldShowExplanationText() const { |
314 return type_ == INSTALL_PROMPT && | 314 return type_ == INSTALL_PROMPT && extension_->is_extension() && |
315 extension_->is_extension() && experiment_ && experiment_->text_only(); | 315 experiment_.get() && experiment_->text_only(); |
316 } | 316 } |
317 | 317 |
318 bool ExtensionInstallPrompt::Prompt::HasAcceptButtonLabel() const { | 318 bool ExtensionInstallPrompt::Prompt::HasAcceptButtonLabel() const { |
319 if (kAcceptButtonIds[type_] == 0) | 319 if (kAcceptButtonIds[type_] == 0) |
320 return false; | 320 return false; |
321 | 321 |
322 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT) | 322 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT) |
323 return ShouldDisplayRevokeFilesButton(); | 323 return ShouldDisplayRevokeFilesButton(); |
324 | 324 |
325 return true; | 325 return true; |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 if (permissions_.get() && | 742 if (permissions_.get() && |
743 (!extension_ || | 743 (!extension_ || |
744 !extensions::PermissionsData::ShouldSkipPermissionWarnings( | 744 !extensions::PermissionsData::ShouldSkipPermissionWarnings( |
745 extension_->id()))) { | 745 extension_->id()))) { |
746 Manifest::Type type = | 746 Manifest::Type type = |
747 extension_ ? extension_->GetType() : Manifest::TYPE_UNKNOWN; | 747 extension_ ? extension_->GetType() : Manifest::TYPE_UNKNOWN; |
748 const extensions::PermissionMessageProvider* message_provider = | 748 const extensions::PermissionMessageProvider* message_provider = |
749 extensions::PermissionMessageProvider::Get(); | 749 extensions::PermissionMessageProvider::Get(); |
750 prompt_->SetPermissions( | 750 prompt_->SetPermissions( |
751 message_provider->GetWarningMessages(permissions_, type)); | 751 message_provider->GetWarningMessages(permissions_.get(), type)); |
752 prompt_->SetPermissionsDetails( | 752 prompt_->SetPermissionsDetails( |
753 message_provider->GetWarningMessagesDetails(permissions_, type)); | 753 message_provider->GetWarningMessagesDetails(permissions_.get(), type)); |
754 } | 754 } |
755 | 755 |
756 switch (prompt_->type()) { | 756 switch (prompt_->type()) { |
757 case PERMISSIONS_PROMPT: | 757 case PERMISSIONS_PROMPT: |
758 case RE_ENABLE_PROMPT: | 758 case RE_ENABLE_PROMPT: |
759 case INLINE_INSTALL_PROMPT: | 759 case INLINE_INSTALL_PROMPT: |
760 case EXTERNAL_INSTALL_PROMPT: | 760 case EXTERNAL_INSTALL_PROMPT: |
761 case INSTALL_PROMPT: | 761 case INSTALL_PROMPT: |
762 case LAUNCH_PROMPT: | 762 case LAUNCH_PROMPT: |
763 case POST_INSTALL_PERMISSIONS_PROMPT: | 763 case POST_INSTALL_PERMISSIONS_PROMPT: |
(...skipping 12 matching lines...) Expand all Loading... |
776 } | 776 } |
777 | 777 |
778 if (AutoConfirmPrompt(delegate_)) | 778 if (AutoConfirmPrompt(delegate_)) |
779 return; | 779 return; |
780 | 780 |
781 if (show_dialog_callback_.is_null()) | 781 if (show_dialog_callback_.is_null()) |
782 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); | 782 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
783 else | 783 else |
784 show_dialog_callback_.Run(show_params_, delegate_, prompt_); | 784 show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
785 } | 785 } |
OLD | NEW |