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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 const ExtensionInstallPrompt::Prompt& prompt, | 95 const ExtensionInstallPrompt::Prompt& prompt, |
96 bool show_launcher_opt_in); | 96 bool show_launcher_opt_in); |
97 virtual ~ExtensionInstallDialogView(); | 97 virtual ~ExtensionInstallDialogView(); |
98 | 98 |
99 // Changes the size of the containing widget to match the preferred size | 99 // Changes the size of the containing widget to match the preferred size |
100 // of this dialog. | 100 // of this dialog. |
101 void SizeToContents(); | 101 void SizeToContents(); |
102 | 102 |
103 private: | 103 private: |
104 // views::DialogDelegateView: | 104 // views::DialogDelegateView: |
105 virtual int GetDialogButtons() const OVERRIDE; | |
105 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 106 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
106 virtual int GetDefaultDialogButton() const OVERRIDE; | 107 virtual int GetDefaultDialogButton() const OVERRIDE; |
107 virtual bool Cancel() OVERRIDE; | 108 virtual bool Cancel() OVERRIDE; |
108 virtual bool Accept() OVERRIDE; | 109 virtual bool Accept() OVERRIDE; |
109 | 110 |
110 // views::WidgetDelegate: | 111 // views::WidgetDelegate: |
111 virtual ui::ModalType GetModalType() const OVERRIDE; | 112 virtual ui::ModalType GetModalType() const OVERRIDE; |
112 virtual string16 GetWindowTitle() const OVERRIDE; | 113 virtual string16 GetWindowTitle() const OVERRIDE; |
113 | 114 |
114 // views::LinkListener: | 115 // views::LinkListener: |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 layout->AddView(app_launcher_opt_in_checkbox_); | 522 layout->AddView(app_launcher_opt_in_checkbox_); |
522 } | 523 } |
523 } | 524 } |
524 | 525 |
525 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} | 526 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} |
526 | 527 |
527 void ExtensionInstallDialogView::SizeToContents() { | 528 void ExtensionInstallDialogView::SizeToContents() { |
528 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | 529 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
529 } | 530 } |
530 | 531 |
532 int ExtensionInstallDialogView::GetDialogButtons() const { | |
533 int buttons = prompt_.GetDialogButtons(); | |
534 // Simply having just an OK button is *not* supported. See comment on function | |
535 // GetDialogButtons in dialog_delegate.h for reasons. | |
536 DCHECK((buttons & ui::DIALOG_BUTTON_CANCEL) > 0); | |
sky
2013/01/29 16:45:05
DCHECK_GT
| |
537 return buttons; | |
538 } | |
539 | |
531 string16 ExtensionInstallDialogView::GetDialogButtonLabel( | 540 string16 ExtensionInstallDialogView::GetDialogButtonLabel( |
532 ui::DialogButton button) const { | 541 ui::DialogButton button) const { |
533 switch (button) { | 542 switch (button) { |
534 case ui::DIALOG_BUTTON_OK: | 543 case ui::DIALOG_BUTTON_OK: |
535 return prompt_.GetAcceptButtonLabel(); | 544 return prompt_.GetAcceptButtonLabel(); |
536 case ui::DIALOG_BUTTON_CANCEL: | 545 case ui::DIALOG_BUTTON_CANCEL: |
537 return prompt_.HasAbortButtonLabel() ? | 546 return prompt_.HasAbortButtonLabel() ? |
538 prompt_.GetAbortButtonLabel() : | 547 prompt_.GetAbortButtonLabel() : |
539 l10n_util::GetStringUTF16(IDS_CANCEL); | 548 l10n_util::GetStringUTF16(IDS_CANCEL); |
540 default: | 549 default: |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
712 rotate.Translate(-arrow_view_->width() / 2.0, | 721 rotate.Translate(-arrow_view_->width() / 2.0, |
713 -arrow_view_->height() / 2.0); | 722 -arrow_view_->height() / 2.0); |
714 } | 723 } |
715 arrow_view_->SetTransform(rotate); | 724 arrow_view_->SetTransform(rotate); |
716 } | 725 } |
717 } | 726 } |
718 | 727 |
719 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { | 728 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { |
720 owner_->SizeToContents(); | 729 owner_->SizeToContents(); |
721 } | 730 } |
OLD | NEW |