| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 dialog_size_ = gfx::Size( | 582 dialog_size_ = gfx::Size( |
| 582 dialog_width, std::min(header_only_size.height(), kDialogMaxHeight)); | 583 dialog_width, std::min(header_only_size.height(), kDialogMaxHeight)); |
| 583 } | 584 } |
| 584 | 585 |
| 585 std::string event_name = ExperienceSamplingEvent::kExtensionInstallDialog; | 586 std::string event_name = ExperienceSamplingEvent::kExtensionInstallDialog; |
| 586 event_name.append( | 587 event_name.append( |
| 587 ExtensionInstallPrompt::PromptTypeToString(prompt_->type())); | 588 ExtensionInstallPrompt::PromptTypeToString(prompt_->type())); |
| 588 sampling_event_ = ExperienceSamplingEvent::Create(event_name); | 589 sampling_event_ = ExperienceSamplingEvent::Create(event_name); |
| 589 } | 590 } |
| 590 | 591 |
| 591 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} | 592 ExtensionInstallDialogView::~ExtensionInstallDialogView() { |
| 593 if (!handled_result_) |
| 594 delegate_->InstallUIAbort(true); |
| 595 } |
| 592 | 596 |
| 593 views::GridLayout* ExtensionInstallDialogView::CreateLayout( | 597 views::GridLayout* ExtensionInstallDialogView::CreateLayout( |
| 594 views::View* parent, | 598 views::View* parent, |
| 595 int left_column_width, | 599 int left_column_width, |
| 596 int column_set_id, | 600 int column_set_id, |
| 597 bool single_detail_row) const { | 601 bool single_detail_row) const { |
| 598 views::GridLayout* layout = views::GridLayout::CreatePanel(parent); | 602 views::GridLayout* layout = views::GridLayout::CreatePanel(parent); |
| 599 parent->SetLayoutManager(layout); | 603 parent->SetLayoutManager(layout); |
| 600 | 604 |
| 601 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); | 605 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 NOTREACHED(); | 711 NOTREACHED(); |
| 708 return base::string16(); | 712 return base::string16(); |
| 709 } | 713 } |
| 710 } | 714 } |
| 711 | 715 |
| 712 int ExtensionInstallDialogView::GetDefaultDialogButton() const { | 716 int ExtensionInstallDialogView::GetDefaultDialogButton() const { |
| 713 return ui::DIALOG_BUTTON_CANCEL; | 717 return ui::DIALOG_BUTTON_CANCEL; |
| 714 } | 718 } |
| 715 | 719 |
| 716 bool ExtensionInstallDialogView::Cancel() { | 720 bool ExtensionInstallDialogView::Cancel() { |
| 721 if (handled_result_) |
| 722 return true; |
| 723 |
| 724 handled_result_ = true; |
| 717 UpdateInstallResultHistogram(false); | 725 UpdateInstallResultHistogram(false); |
| 718 if (sampling_event_.get()) | 726 if (sampling_event_) |
| 719 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny); | 727 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny); |
| 720 delegate_->InstallUIAbort(true); | 728 delegate_->InstallUIAbort(true); |
| 721 return true; | 729 return true; |
| 722 } | 730 } |
| 723 | 731 |
| 724 bool ExtensionInstallDialogView::Accept() { | 732 bool ExtensionInstallDialogView::Accept() { |
| 733 DCHECK(!handled_result_); |
| 734 |
| 735 handled_result_ = true; |
| 725 UpdateInstallResultHistogram(true); | 736 UpdateInstallResultHistogram(true); |
| 726 if (sampling_event_.get()) | 737 if (sampling_event_) |
| 727 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); | 738 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); |
| 728 delegate_->InstallUIProceed(); | 739 delegate_->InstallUIProceed(); |
| 729 return true; | 740 return true; |
| 730 } | 741 } |
| 731 | 742 |
| 732 ui::ModalType ExtensionInstallDialogView::GetModalType() const { | 743 ui::ModalType ExtensionInstallDialogView::GetModalType() const { |
| 733 return ui::MODAL_TYPE_WINDOW; | 744 return ui::MODAL_TYPE_WINDOW; |
| 734 } | 745 } |
| 735 | 746 |
| 736 base::string16 ExtensionInstallDialogView::GetWindowTitle() const { | 747 base::string16 ExtensionInstallDialogView::GetWindowTitle() const { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 void ExpandableContainerView::ExpandWithoutAnimation() { | 1078 void ExpandableContainerView::ExpandWithoutAnimation() { |
| 1068 expanded_ = true; | 1079 expanded_ = true; |
| 1069 details_view_->AnimateToState(1.0); | 1080 details_view_->AnimateToState(1.0); |
| 1070 } | 1081 } |
| 1071 | 1082 |
| 1072 // static | 1083 // static |
| 1073 ExtensionInstallPrompt::ShowDialogCallback | 1084 ExtensionInstallPrompt::ShowDialogCallback |
| 1074 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 1085 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
| 1075 return base::Bind(&ShowExtensionInstallDialogImpl); | 1086 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 1076 } | 1087 } |
| OLD | NEW |