| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_MEDIA_MEDIA_THROTTLE_INFOBAR_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_MEDIA_MEDIA_THROTTLE_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "components/infobars/core/confirm_infobar_delegate.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class WebContents; | |
| 16 } | |
| 17 | |
| 18 enum UMAThrottleInfobarResponse { | |
| 19 UMA_THROTTLE_INFOBAR_NO_RESPONSE, | |
| 20 UMA_THROTTLE_INFOBAR_TRY_AGAIN, | |
| 21 UMA_THROTTLE_INFOBAR_WAIT, | |
| 22 UMA_THROTTLE_INFOBAR_DISMISSED, | |
| 23 // NOTE: Add responses only immediately above this line. Make sure to | |
| 24 // update the enum list in tools/metrics/histograms/histograms.xml | |
| 25 // accordingly. | |
| 26 UMA_THROTTLE_INFOBAR_RESPONSE_COUNT | |
| 27 }; | |
| 28 | |
| 29 class MediaThrottleInfoBarDelegate : public ConfirmInfoBarDelegate { | |
| 30 public: | |
| 31 typedef base::Callback<void(bool)> DecodeRequestGrantedCallback; | |
| 32 ~MediaThrottleInfoBarDelegate() override; | |
| 33 | |
| 34 // Static method to create the object | |
| 35 static void Create( | |
| 36 content::WebContents* web_contents, | |
| 37 const DecodeRequestGrantedCallback& callback); | |
| 38 | |
| 39 private: | |
| 40 explicit MediaThrottleInfoBarDelegate( | |
| 41 const DecodeRequestGrantedCallback& callback); | |
| 42 | |
| 43 // ConfirmInfoBarDelegate: | |
| 44 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
| 45 MediaThrottleInfoBarDelegate* AsMediaThrottleInfoBarDelegate() override; | |
| 46 base::string16 GetMessageText() const override; | |
| 47 int GetIconId() const override; | |
| 48 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
| 49 bool Accept() override; | |
| 50 bool Cancel() override; | |
| 51 void InfoBarDismissed() override; | |
| 52 | |
| 53 UMAThrottleInfobarResponse infobar_response_; | |
| 54 | |
| 55 DecodeRequestGrantedCallback decode_granted_callback_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(MediaThrottleInfoBarDelegate); | |
| 58 }; | |
| 59 | |
| 60 #endif // CHROME_BROWSER_ANDROID_MEDIA_MEDIA_THROTTLE_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |