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_HUNG_RENDERER_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 9 |
| 10 namespace content { |
| 11 class WebContent; |
| 12 } |
| 13 |
| 14 // This class is responsible for customizing a hung renderer infobar. |
| 15 // If the "kill" dialog is clicked, the renderer of the corresponding |
| 16 // WebContents will be shutdown. |
| 17 class HungRendererInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 18 public: |
| 19 // The caller must ensure that |web_contents| outlives the delegate. |
| 20 // This will naturally occur if the associated InfoBar is managed by the |
| 21 // InfoBarService. |
| 22 explicit HungRendererInfoBarDelegate(content::WebContents* web_contents); |
| 23 ~HungRendererInfoBarDelegate() override; |
| 24 |
| 25 // InfoBarDelegate: |
| 26 void InfoBarDismissed() override; |
| 27 HungRendererInfoBarDelegate* AsHungRendererInfoBarDelegate() override; |
| 28 |
| 29 // ConfirmInfoBarDelegate: |
| 30 int GetIconID() const override; |
| 31 base::string16 GetMessageText() const override; |
| 32 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 33 bool Accept() override; |
| 34 bool Cancel() override; |
| 35 |
| 36 // Called when the renderer regains responsiveness before the dialog is |
| 37 // dismissed. |
| 38 void OnRendererResponsive(); |
| 39 |
| 40 private: |
| 41 // Keep these values in alignment with their histograms.xml counterparts. |
| 42 enum Action { WAIT = 0, KILL, DISMISS, RESPONSIVE, REMOVE, ACTION_COUNT }; |
| 43 void LogAction(Action action); |
| 44 |
| 45 content::WebContents* web_contents_; |
| 46 |
| 47 bool action_logged_for_uma_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(HungRendererInfoBarDelegate); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_ |
OLD | NEW |