Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/android/hung_renderer_infobar_delegate.h

Issue 1299513002: [Android] Add support for a hung renderer dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 WebContents;
12 }
13
14 // A hung renderer infobar is shown when the when the renderer is deemed
15 // unresponsive. The infobar provides the user with a choice of either
16 // waiting for the renderer to regain responsiveness, or killing the
17 // renderer immediately. This class provides the resources necessary to
18 // display such an infobar, also logging the action taken by the user
19 // (if any) for UMA purposes.
20 class HungRendererInfoBarDelegate : public ConfirmInfoBarDelegate {
21 public:
22 // Creates a hung renderer InfoBar, adding it to the InfoBarService
23 // associated with the provided |web_contents|.
24 static void Create(content::WebContents* web_contents);
25
26 // Called if the renderer regains responsiveness before the infobar is
27 // dismissed.
28 void OnRendererResponsive();
29
30 private:
31 // Keep these values in alignment with their histograms.xml counterparts.
32 enum Event {
33 WAIT_CLICKED = 0,
34 KILL_CLICKED,
35 CLOSE_CLICKED,
36 RENDERER_BECAME_RESPONSIVE,
37 INFOBAR_SHUTDOWN,
38 EVENT_COUNT
39 };
40
41 explicit HungRendererInfoBarDelegate(content::WebContents* web_contents);
42 ~HungRendererInfoBarDelegate() override;
43
44 // ConfirmInfoBarDelegate:
45 void InfoBarDismissed() override;
46 HungRendererInfoBarDelegate* AsHungRendererInfoBarDelegate() override;
47 int GetIconID() const override;
48 base::string16 GetMessageText() const override;
49 base::string16 GetButtonLabel(InfoBarButton button) const override;
50 bool Accept() override;
51 bool Cancel() override;
52
53 void LogEvent(Event event);
54
55 content::WebContents* web_contents_;
56
57 bool terminal_event_logged_for_uma_;
58
59 DISALLOW_COPY_AND_ASSIGN(HungRendererInfoBarDelegate);
60 };
61
62 #endif // CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698