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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/hung_renderer_infobar_delegate.h
diff --git a/chrome/browser/android/hung_renderer_infobar_delegate.h b/chrome/browser/android/hung_renderer_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..27b8d29c4370e5b02feb2f76168220998369c520
--- /dev/null
+++ b/chrome/browser/android/hung_renderer_infobar_delegate.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_
+
+#include "components/infobars/core/confirm_infobar_delegate.h"
+
+namespace content {
+class WebContent;
+}
+
+// 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.
+// 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.
+// 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.
+class HungRendererInfoBarDelegate : public ConfirmInfoBarDelegate {
+ 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.
+ // The caller must ensure that |web_contents| outlives the delegate.
+ // This will naturally occur if the associated InfoBar is managed by the
+ // InfoBarService.
+ explicit HungRendererInfoBarDelegate(content::WebContents* web_contents);
+ ~HungRendererInfoBarDelegate() override;
+
+ // 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.
+ void InfoBarDismissed() override;
+ HungRendererInfoBarDelegate* AsHungRendererInfoBarDelegate() override;
+
+ // ConfirmInfoBarDelegate:
+ int GetIconID() const override;
+ base::string16 GetMessageText() const override;
+ base::string16 GetButtonLabel(InfoBarButton button) const override;
+ bool Accept() override;
+ bool Cancel() override;
+
+ // 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.
+ // dismissed.
+ void OnRendererResponsive();
+
+ private:
+ // Keep these values in alignment with their histograms.xml counterparts.
+ 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
+ void LogAction(Action action);
+
+ content::WebContents* web_contents_;
+
+ bool action_logged_for_uma_;
+
+ DISALLOW_COPY_AND_ASSIGN(HungRendererInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_ANDROID_HUNG_RENDERER_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698