| 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; |
| 98 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 99 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 99 virtual int GetDefaultDialogButton() const OVERRIDE; | 100 virtual int GetDefaultDialogButton() const OVERRIDE; |
| 100 virtual bool Cancel() OVERRIDE; | 101 virtual bool Cancel() OVERRIDE; |
| 101 virtual bool Accept() OVERRIDE; | 102 virtual bool Accept() OVERRIDE; |
| 102 | 103 |
| 103 // views::WidgetDelegate: | 104 // views::WidgetDelegate: |
| 104 virtual ui::ModalType GetModalType() const OVERRIDE; | 105 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 105 virtual string16 GetWindowTitle() const OVERRIDE; | 106 virtual string16 GetWindowTitle() const OVERRIDE; |
| 106 | 107 |
| 107 // views::LinkListener: | 108 // views::LinkListener: |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 437 } |
| 437 } | 438 } |
| 438 } | 439 } |
| 439 | 440 |
| 440 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} | 441 ExtensionInstallDialogView::~ExtensionInstallDialogView() {} |
| 441 | 442 |
| 442 void ExtensionInstallDialogView::SizeToContents() { | 443 void ExtensionInstallDialogView::SizeToContents() { |
| 443 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | 444 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
| 444 } | 445 } |
| 445 | 446 |
| 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 |
| 446 string16 ExtensionInstallDialogView::GetDialogButtonLabel( | 455 string16 ExtensionInstallDialogView::GetDialogButtonLabel( |
| 447 ui::DialogButton button) const { | 456 ui::DialogButton button) const { |
| 448 switch (button) { | 457 switch (button) { |
| 449 case ui::DIALOG_BUTTON_OK: | 458 case ui::DIALOG_BUTTON_OK: |
| 450 return prompt_.GetAcceptButtonLabel(); | 459 return prompt_.GetAcceptButtonLabel(); |
| 451 case ui::DIALOG_BUTTON_CANCEL: | 460 case ui::DIALOG_BUTTON_CANCEL: |
| 452 return prompt_.HasAbortButtonLabel() ? | 461 return prompt_.HasAbortButtonLabel() ? |
| 453 prompt_.GetAbortButtonLabel() : | 462 prompt_.GetAbortButtonLabel() : |
| 454 l10n_util::GetStringUTF16(IDS_CANCEL); | 463 l10n_util::GetStringUTF16(IDS_CANCEL); |
| 455 default: | 464 default: |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 rotate.Translate(-arrow_view_->width() / 2.0, | 631 rotate.Translate(-arrow_view_->width() / 2.0, |
| 623 -arrow_view_->height() / 2.0); | 632 -arrow_view_->height() / 2.0); |
| 624 } | 633 } |
| 625 arrow_view_->SetTransform(rotate); | 634 arrow_view_->SetTransform(rotate); |
| 626 } | 635 } |
| 627 } | 636 } |
| 628 | 637 |
| 629 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { | 638 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { |
| 630 owner_->SizeToContents(); | 639 owner_->SizeToContents(); |
| 631 } | 640 } |
| OLD | NEW |