| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/media/media_throttle_infobar_delegate.h" | 5 #include "chrome/browser/android/media/media_throttle_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 MediaThrottleInfoBarDelegate* | 46 MediaThrottleInfoBarDelegate* |
| 47 MediaThrottleInfoBarDelegate::AsMediaThrottleInfoBarDelegate() { | 47 MediaThrottleInfoBarDelegate::AsMediaThrottleInfoBarDelegate() { |
| 48 return this; | 48 return this; |
| 49 } | 49 } |
| 50 | 50 |
| 51 base::string16 MediaThrottleInfoBarDelegate::GetMessageText() const { | 51 base::string16 MediaThrottleInfoBarDelegate::GetMessageText() const { |
| 52 return l10n_util::GetStringUTF16(IDS_MEDIA_THROTTLE_INFOBAR_TEXT); | 52 return l10n_util::GetStringUTF16(IDS_MEDIA_THROTTLE_INFOBAR_TEXT); |
| 53 } | 53 } |
| 54 | 54 |
| 55 int MediaThrottleInfoBarDelegate::GetIconId() const { |
| 56 return IDR_INFOBAR_WARNING; |
| 57 } |
| 58 |
| 55 base::string16 MediaThrottleInfoBarDelegate::GetButtonLabel( | 59 base::string16 MediaThrottleInfoBarDelegate::GetButtonLabel( |
| 56 InfoBarButton button) const { | 60 InfoBarButton button) const { |
| 57 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 61 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 58 IDS_MEDIA_THROTTLE_INFOBAR_BLOCK_BUTTON : | 62 IDS_MEDIA_THROTTLE_INFOBAR_BLOCK_BUTTON : |
| 59 IDS_MEDIA_THROTTLE_INFOBAR_ALLOW_BUTTON); | 63 IDS_MEDIA_THROTTLE_INFOBAR_ALLOW_BUTTON); |
| 60 } | 64 } |
| 61 | 65 |
| 62 bool MediaThrottleInfoBarDelegate::Accept() { | 66 bool MediaThrottleInfoBarDelegate::Accept() { |
| 63 decode_granted_callback_.Run(false); | 67 decode_granted_callback_.Run(false); |
| 64 return true; | 68 return true; |
| 65 } | 69 } |
| 66 | 70 |
| 67 bool MediaThrottleInfoBarDelegate::Cancel() { | 71 bool MediaThrottleInfoBarDelegate::Cancel() { |
| 68 decode_granted_callback_.Run(true); | 72 decode_granted_callback_.Run(true); |
| 69 return true; | 73 return true; |
| 70 } | 74 } |
| 71 | 75 |
| 72 void MediaThrottleInfoBarDelegate::InfoBarDismissed() { | 76 void MediaThrottleInfoBarDelegate::InfoBarDismissed() { |
| 73 decode_granted_callback_.Run(false); | 77 decode_granted_callback_.Run(false); |
| 74 } | 78 } |
| OLD | NEW |