OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/infobar_delegate.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "chrome/common/l10n_util.h" |
| 9 |
| 10 #include "generated_resources.h" |
| 11 |
| 12 // AlertInfoBarDelegate, InfoBarDelegate overrides: ---------------------------- |
| 13 |
| 14 bool AlertInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
| 15 AlertInfoBarDelegate* alert_delegate = delegate->AsAlertInfoBarDelegate(); |
| 16 if (!alert_delegate) |
| 17 return false; |
| 18 |
| 19 return alert_delegate->GetMessageText() == GetMessageText(); |
| 20 } |
| 21 |
| 22 // ConfirmInfoBarDelegate, public: --------------------------------------------- |
| 23 |
| 24 std::wstring ConfirmInfoBarDelegate::GetButtonLabel( |
| 25 InfoBarButton button) const { |
| 26 if (button == BUTTON_OK) |
| 27 return l10n_util::GetString(IDS_OK); |
| 28 if (button == BUTTON_CANCEL) |
| 29 return l10n_util::GetString(IDS_CANCEL); |
| 30 NOTREACHED(); |
| 31 return std::wstring(); |
| 32 } |
| 33 |
| 34 // SimpleAlertInfoBarDelegate, public: ----------------------------------------- |
| 35 |
| 36 SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( |
| 37 const std::wstring& message, SkBitmap* icon) |
| 38 : message_(message), |
| 39 icon_(icon) { |
| 40 } |
| 41 |
| 42 // SimpleAlertInfoBarDelegate, AlertInfoBarDelegate implementation: ------------ |
| 43 |
| 44 std::wstring SimpleAlertInfoBarDelegate::GetMessageText() const { |
| 45 return message_; |
| 46 } |
| 47 |
| 48 SkBitmap* SimpleAlertInfoBarDelegate::GetIcon() const { |
| 49 return icon_; |
| 50 } |
| 51 |
| 52 void SimpleAlertInfoBarDelegate::InfoBarClosed() { |
| 53 delete this; |
| 54 } |
OLD | NEW |