| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 ExtensionInstallPrompt::Delegate* delegate, | 88 ExtensionInstallPrompt::Delegate* delegate, |
| 89 const ExtensionInstallPrompt::Prompt& prompt); | 89 const ExtensionInstallPrompt::Prompt& prompt); |
| 90 virtual ~ExtensionInstallDialogView(); | 90 virtual ~ExtensionInstallDialogView(); |
| 91 | 91 |
| 92 // Changes the size of the containing widget to match the preferred size | 92 // Changes the size of the containing widget to match the preferred size |
| 93 // of this dialog. | 93 // of this dialog. |
| 94 void SizeToContents(); | 94 void SizeToContents(); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 // views::DialogDelegateView: | 97 // views::DialogDelegateView: |
| 98 virtual int GetDialogButtons() const OVERRIDE; | |
| 99 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 98 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 100 virtual int GetDefaultDialogButton() const OVERRIDE; | 99 virtual int GetDefaultDialogButton() const OVERRIDE; |
| 101 virtual bool Cancel() OVERRIDE; | 100 virtual bool Cancel() OVERRIDE; |
| 102 virtual bool Accept() OVERRIDE; | 101 virtual bool Accept() OVERRIDE; |
| 103 | 102 |
| 104 // views::WidgetDelegate: | 103 // views::WidgetDelegate: |
| 105 virtual ui::ModalType GetModalType() const OVERRIDE; | 104 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 106 virtual string16 GetWindowTitle() const OVERRIDE; | 105 virtual string16 GetWindowTitle() const OVERRIDE; |
| 107 | 106 |
| 108 // views::LinkListener: | 107 // views::LinkListener: |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 436 } |
| 438 } | 437 } |
| 439 } | 438 } |
| 440 | 439 |
| 441 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} | 440 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} |
| 442 | 441 |
| 443 void ExtensionInstallDialogView::SizeToContents() { | 442 void ExtensionInstallDialogView::SizeToContents() { |
| 444 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | 443 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
| 445 } | 444 } |
| 446 | 445 |
| 447 int ExtensionInstallDialogView::GetDialogButtons() const { | |
| 448 int buttons = prompt_.GetDialogButtons(); | |
| 449 // Simply having just an OK button is *not* supported. See comment on function | |
| 450 // GetDialogButtons in dialog_delegate.h for reasons. | |
| 451 DCHECK_GT(buttons & ui::DIALOG_BUTTON_CANCEL, 0); | |
| 452 return buttons; | |
| 453 } | |
| 454 | |
| 455 string16 ExtensionInstallDialogView::GetDialogButtonLabel( | 446 string16 ExtensionInstallDialogView::GetDialogButtonLabel( |
| 456 ui::DialogButton button) const { | 447 ui::DialogButton button) const { |
| 457 switch (button) { | 448 switch (button) { |
| 458 case ui::DIALOG_BUTTON_OK: | 449 case ui::DIALOG_BUTTON_OK: |
| 459 return prompt_.GetAcceptButtonLabel(); | 450 return prompt_.GetAcceptButtonLabel(); |
| 460 case ui::DIALOG_BUTTON_CANCEL: | 451 case ui::DIALOG_BUTTON_CANCEL: |
| 461 return prompt_.HasAbortButtonLabel() ? | 452 return prompt_.HasAbortButtonLabel() ? |
| 462 prompt_.GetAbortButtonLabel() : | 453 prompt_.GetAbortButtonLabel() : |
| 463 l10n_util::GetStringUTF16(IDS_CANCEL); | 454 l10n_util::GetStringUTF16(IDS_CANCEL); |
| 464 default: | 455 default: |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 rotate.Translate(-arrow_view_->width() / 2.0, | 622 rotate.Translate(-arrow_view_->width() / 2.0, |
| 632 -arrow_view_->height() / 2.0); | 623 -arrow_view_->height() / 2.0); |
| 633 } | 624 } |
| 634 arrow_view_->SetTransform(rotate); | 625 arrow_view_->SetTransform(rotate); |
| 635 } | 626 } |
| 636 } | 627 } |
| 637 | 628 |
| 638 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { | 629 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { |
| 639 owner_->SizeToContents(); | 630 owner_->SizeToContents(); |
| 640 } | 631 } |
| OLD | NEW |