Chromium Code Reviews| 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/ui/views/extensions/extension_install_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 ExtensionInstallPrompt::Delegate* delegate, | 188 ExtensionInstallPrompt::Delegate* delegate, |
| 189 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) | 189 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) |
| 190 : navigator_(navigator), | 190 : navigator_(navigator), |
| 191 delegate_(delegate), | 191 delegate_(delegate), |
| 192 prompt_(prompt), | 192 prompt_(prompt), |
| 193 scroll_view_(NULL), | 193 scroll_view_(NULL), |
| 194 scrollable_(NULL), | 194 scrollable_(NULL), |
| 195 scrollable_header_only_(NULL), | 195 scrollable_header_only_(NULL), |
| 196 show_details_link_(NULL), | 196 show_details_link_(NULL), |
| 197 checkbox_info_label_(NULL), | 197 checkbox_info_label_(NULL), |
| 198 unchecked_boxes_(0) { | 198 unchecked_boxes_(0), |
| 199 handled_result_(false) { | |
| 199 // Possible grid layouts without ExtensionPermissionDialog experiment: | 200 // Possible grid layouts without ExtensionPermissionDialog experiment: |
| 200 // Inline install | 201 // Inline install |
| 201 // w/ permissions no permissions | 202 // w/ permissions no permissions |
| 202 // +--------------------+------+ +--------------+------+ | 203 // +--------------------+------+ +--------------+------+ |
| 203 // | heading | icon | | heading | icon | | 204 // | heading | icon | | heading | icon | |
| 204 // +--------------------| | +--------------| | | 205 // +--------------------| | +--------------| | |
| 205 // | rating | | | rating | | | 206 // | rating | | | rating | | |
| 206 // +--------------------| | +--------------+ | | 207 // +--------------------| | +--------------+ | |
| 207 // | user_count | | | user_count | | | 208 // | user_count | | | user_count | | |
| 208 // +--------------------| | +--------------| | | 209 // +--------------------| | +--------------| | |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 NOTREACHED(); | 708 NOTREACHED(); |
| 708 return base::string16(); | 709 return base::string16(); |
| 709 } | 710 } |
| 710 } | 711 } |
| 711 | 712 |
| 712 int ExtensionInstallDialogView::GetDefaultDialogButton() const { | 713 int ExtensionInstallDialogView::GetDefaultDialogButton() const { |
| 713 return ui::DIALOG_BUTTON_CANCEL; | 714 return ui::DIALOG_BUTTON_CANCEL; |
| 714 } | 715 } |
| 715 | 716 |
| 716 bool ExtensionInstallDialogView::Cancel() { | 717 bool ExtensionInstallDialogView::Cancel() { |
| 717 UpdateInstallResultHistogram(false); | 718 OnInstallAborted(); |
| 718 if (sampling_event_.get()) | |
| 719 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny); | |
| 720 delegate_->InstallUIAbort(true); | |
| 721 return true; | 719 return true; |
| 722 } | 720 } |
| 723 | 721 |
| 724 bool ExtensionInstallDialogView::Accept() { | 722 bool ExtensionInstallDialogView::Accept() { |
| 723 DCHECK(!handled_result_); | |
| 724 | |
| 725 handled_result_ = true; | |
| 725 UpdateInstallResultHistogram(true); | 726 UpdateInstallResultHistogram(true); |
| 726 if (sampling_event_.get()) | 727 if (sampling_event_.get()) |
| 727 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); | 728 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); |
| 728 delegate_->InstallUIProceed(); | 729 delegate_->InstallUIProceed(); |
| 729 return true; | 730 return true; |
| 730 } | 731 } |
| 731 | 732 |
| 733 void ExtensionInstallDialogView::OnClosed() { | |
| 734 // The install dialog may have been closed without the user selecting accept | |
| 735 // or cancel, so ensure this case is treated as an abort. | |
| 736 OnInstallAborted(); | |
| 737 } | |
| 738 | |
| 732 ui::ModalType ExtensionInstallDialogView::GetModalType() const { | 739 ui::ModalType ExtensionInstallDialogView::GetModalType() const { |
| 733 return ui::MODAL_TYPE_WINDOW; | 740 return ui::MODAL_TYPE_WINDOW; |
| 734 } | 741 } |
| 735 | 742 |
| 736 base::string16 ExtensionInstallDialogView::GetWindowTitle() const { | 743 base::string16 ExtensionInstallDialogView::GetWindowTitle() const { |
| 737 return prompt_->GetDialogTitle(); | 744 return prompt_->GetDialogTitle(); |
| 738 } | 745 } |
| 739 | 746 |
| 740 void ExtensionInstallDialogView::LinkClicked(views::Link* source, | 747 void ExtensionInstallDialogView::LinkClicked(views::Link* source, |
| 741 int event_flags) { | 748 int event_flags) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 NUM_LINK_ACTIONS); | 855 NUM_LINK_ACTIONS); |
| 849 } else { | 856 } else { |
| 850 // The clickable link in the UI is "Show Details". | 857 // The clickable link in the UI is "Show Details". |
| 851 UMA_HISTOGRAM_ENUMERATION( | 858 UMA_HISTOGRAM_ENUMERATION( |
| 852 "Extensions.InstallPromptExperiment.ShowDetails", | 859 "Extensions.InstallPromptExperiment.ShowDetails", |
| 853 action_type, | 860 action_type, |
| 854 NUM_LINK_ACTIONS); | 861 NUM_LINK_ACTIONS); |
| 855 } | 862 } |
| 856 } | 863 } |
| 857 | 864 |
| 865 void ExtensionInstallDialogView::OnInstallAborted() { | |
| 866 if (handled_result_) | |
| 867 return; | |
| 868 | |
| 869 handled_result_ = true; | |
| 870 UpdateInstallResultHistogram(false); | |
| 871 if (sampling_event_.get()) | |
|
tapted
2014/09/08 07:42:20
nit: pretty sure Chrome prefers dropping the `.get
tmdiep
2014/09/08 08:26:08
Done.
| |
| 872 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny); | |
| 873 delegate_->InstallUIAbort(true); | |
| 874 } | |
| 875 | |
| 858 // ExpandableContainerView::DetailsView ---------------------------------------- | 876 // ExpandableContainerView::DetailsView ---------------------------------------- |
| 859 | 877 |
| 860 ExpandableContainerView::DetailsView::DetailsView(int horizontal_space, | 878 ExpandableContainerView::DetailsView::DetailsView(int horizontal_space, |
| 861 bool parent_bulleted, | 879 bool parent_bulleted, |
| 862 bool lighter_color) | 880 bool lighter_color) |
| 863 : layout_(new views::GridLayout(this)), | 881 : layout_(new views::GridLayout(this)), |
| 864 state_(0), | 882 state_(0), |
| 865 lighter_color_(lighter_color) { | 883 lighter_color_(lighter_color) { |
| 866 SetLayoutManager(layout_); | 884 SetLayoutManager(layout_); |
| 867 views::ColumnSet* column_set = layout_->AddColumnSet(0); | 885 views::ColumnSet* column_set = layout_->AddColumnSet(0); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1067 void ExpandableContainerView::ExpandWithoutAnimation() { | 1085 void ExpandableContainerView::ExpandWithoutAnimation() { |
| 1068 expanded_ = true; | 1086 expanded_ = true; |
| 1069 details_view_->AnimateToState(1.0); | 1087 details_view_->AnimateToState(1.0); |
| 1070 } | 1088 } |
| 1071 | 1089 |
| 1072 // static | 1090 // static |
| 1073 ExtensionInstallPrompt::ShowDialogCallback | 1091 ExtensionInstallPrompt::ShowDialogCallback |
| 1074 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 1092 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
| 1075 return base::Bind(&ShowExtensionInstallDialogImpl); | 1093 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 1076 } | 1094 } |
| OLD | NEW |