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. | |
Peter Kasting
2015/09/01 22:24:05
Nit: "customizing"? That sounds as if there's alr
jdduke (slow)
2015/09/02 00:04:01
Done.
| |
15 // If the "kill" dialog is clicked, the renderer of the corresponding | |
Peter Kasting
2015/09/01 22:24:05
Nit: Did you mean "button" instead of "dialog"?
jdduke (slow)
2015/09/02 00:04:01
Yeah, rephrased in the new comment.
| |
16 // WebContents will be shutdown. | |
Peter Kasting
2015/09/01 22:24:05
Nit: shut down (shutdown is a noun)
jdduke (slow)
2015/09/02 00:04:01
Yeah, also removed in the new phrasing.
| |
17 class HungRendererInfoBarDelegate : public ConfirmInfoBarDelegate { | |
18 public: | |
Peter Kasting
2015/09/01 22:24:05
Almost none of this stuff should be public. You s
jdduke (slow)
2015/09/02 00:04:01
Done.
| |
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: | |
Peter Kasting
2015/09/01 22:24:05
You don't directly subclass InfoBarDelegate, so th
jdduke (slow)
2015/09/02 00:04:01
Done.
| |
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 | |
Peter Kasting
2015/09/01 22:24:05
Nit: when -> if?
jdduke (slow)
2015/09/02 00:04:01
Done.
| |
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 }; | |
Peter Kasting
2015/09/01 22:24:05
Nit: RESPONSIVE is not an action. Perhaps you mea
jdduke (slow)
2015/09/02 00:04:01
I thought of using RESULT, as we'd really like jus
| |
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 |