OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/infobars/infobars.h" | 5 #include "chrome/browser/ui/views/infobars/infobars.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/views/event_utils.h" | 10 #include "chrome/browser/ui/views/event_utils.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 // ConfirmInfoBar, public: ----------------------------------------------------- | 465 // ConfirmInfoBar, public: ----------------------------------------------------- |
466 | 466 |
467 ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate) | 467 ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate) |
468 : AlertInfoBar(delegate), | 468 : AlertInfoBar(delegate), |
469 ok_button_(NULL), | 469 ok_button_(NULL), |
470 cancel_button_(NULL), | 470 cancel_button_(NULL), |
471 link_(NULL), | 471 link_(NULL), |
472 initialized_(false) { | 472 initialized_(false) { |
473 ok_button_ = InfoBarTextButton::Create(this, | 473 ok_button_ = InfoBarTextButton::Create(this, |
474 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); | 474 (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) ? |
| 475 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK) : |
| 476 string16()); |
475 ok_button_->SetAccessibleName(WideToUTF16Hack(ok_button_->text())); | 477 ok_button_->SetAccessibleName(WideToUTF16Hack(ok_button_->text())); |
476 cancel_button_ = InfoBarTextButton::Create(this, | 478 cancel_button_ = InfoBarTextButton::Create(this, |
477 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 479 (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) ? |
| 480 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL) : |
| 481 string16()); |
478 cancel_button_->SetAccessibleName(WideToUTF16Hack(cancel_button_->text())); | 482 cancel_button_->SetAccessibleName(WideToUTF16Hack(cancel_button_->text())); |
479 | 483 |
480 // Set up the link. | 484 // Set up the link. |
481 link_ = new views::Link; | 485 link_ = new views::Link; |
482 link_->SetText(UTF16ToWideHack(delegate->GetLinkText())); | 486 link_->SetText(UTF16ToWideHack(delegate->GetLinkText())); |
483 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 487 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
484 link_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 488 link_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
485 link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 489 link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
486 link_->SetController(this); | 490 link_->SetController(this); |
487 link_->MakeReadableOverBackgroundColor(background()->get_color()); | 491 link_->MakeReadableOverBackgroundColor(background()->get_color()); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 608 |
605 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { | 609 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { |
606 return new LinkInfoBar(this); | 610 return new LinkInfoBar(this); |
607 } | 611 } |
608 | 612 |
609 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- | 613 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- |
610 | 614 |
611 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { | 615 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { |
612 return new ConfirmInfoBar(this); | 616 return new ConfirmInfoBar(this); |
613 } | 617 } |
OLD | NEW |