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

Side by Side Diff: chrome/browser/ui/webui/hung_renderer_dialog.h

Issue 8510071: Revert 109984 - Tests for WebUI Hung Renderer Dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
Property Changes:
Deleted: svn:mergeinfo
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
6 #define CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h"
13 #include "base/string16.h" 12 #include "base/string16.h"
14 #include "base/values.h" 13 #include "base/values.h"
15 #include "chrome/browser/ui/webui/html_dialog_ui.h" 14 #include "chrome/browser/ui/webui/html_dialog_ui.h"
16 #include "content/browser/tab_contents/tab_contents_observer.h"
17 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
18 16
19 class TabContents; 17 class TabContents;
20 class HungRendererDialogHandler; 18 class HungRendererDialogHandler;
21 19
22 class HungRendererDialog : private HtmlDialogUIDelegate { 20 class HungRendererDialog : private HtmlDialogUIDelegate {
23 public: 21 public:
24 // Shows a hung renderer dialog. 22 // Shows a hung renderer dialog.
25 static void ShowHungRendererDialog(TabContents* contents); 23 static void ShowHungRendererDialog(TabContents* contents);
26 24
27 // Hides a hung renderer dialog. 25 // Hides a hung renderer dialog.
28 static void HideHungRendererDialog(TabContents* contents); 26 static void HideHungRendererDialog(TabContents* contents);
29 27
30 private: 28 private:
31 class TabContentsObserverImpl : public TabContentsObserver { 29 HungRendererDialog();
32 public:
33 TabContentsObserverImpl(HungRendererDialog* dialog,
34 TabContents* contents);
35
36 // TabContentsObserver overrides:
37 virtual void RenderViewGone() OVERRIDE;
38 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE;
39
40 private:
41 TabContents* contents_; // weak
42 HungRendererDialog* dialog_; // weak
43
44 DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl);
45 };
46
47 friend class HungRendererDialogUITest;
48
49 explicit HungRendererDialog(bool is_enabled);
50 virtual ~HungRendererDialog();
51
52 // Shows a hung renderer dialog that, if not enabled, won't kill processes
53 // or restart hang timers.
54 static void ShowHungRendererDialogInternal(TabContents* contents,
55 bool is_enabled);
56 30
57 // Shows the hung renderer dialog. 31 // Shows the hung renderer dialog.
58 void ShowDialog(TabContents* contents); 32 void ShowDialog(TabContents* contents);
59 33
60 // Hides the hung renderer dialog. 34 // Hides the hung renderer dialog.
61 void HideDialog(TabContents* contents); 35 void HideDialog(TabContents* contents);
62 36
63 // HtmlDialogUIDelegate methods 37 // HtmlDialogUIDelegate methods
64 virtual bool IsDialogModal() const OVERRIDE; 38 virtual bool IsDialogModal() const OVERRIDE;
65 virtual string16 GetDialogTitle() const OVERRIDE; 39 virtual string16 GetDialogTitle() const OVERRIDE;
66 virtual GURL GetDialogContentURL() const OVERRIDE; 40 virtual GURL GetDialogContentURL() const OVERRIDE;
67 virtual void GetWebUIMessageHandlers( 41 virtual void GetWebUIMessageHandlers(
68 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; 42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
69 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
70 virtual std::string GetDialogArgs() const OVERRIDE; 44 virtual std::string GetDialogArgs() const OVERRIDE;
71 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
72 virtual void OnCloseContents(TabContents* source, 46 virtual void OnCloseContents(TabContents* source,
73 bool* out_close_dialog) OVERRIDE; 47 bool* out_close_dialog) OVERRIDE;
74 virtual bool ShouldShowDialogTitle() const OVERRIDE; 48 virtual bool ShouldShowDialogTitle() const OVERRIDE;
75 49
76 // The tab contents. 50 // The tab contents.
77 TabContents* contents_; 51 TabContents* contents_;
78 52
79 // The dialog handler. 53 // The dialog handler.
80 HungRendererDialogHandler* handler_; 54 HungRendererDialogHandler* handler_;
81 55
82 // A safety switch that must be enabled to allow actual killing of processes
83 // or restarting of the hang timer. This is necessary so that tests can
84 // create a disabled version of this dialog that won't kill processes or
85 // restart timers when the dialog closes at the end of the test.
86 bool is_enabled_;
87
88 // The dialog window. 56 // The dialog window.
89 gfx::NativeWindow window_; 57 gfx::NativeWindow window_;
90 58
91 scoped_ptr<TabContentsObserverImpl> contents_observer_;
92
93 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); 59 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog);
94 }; 60 };
95 61
96 // Dialog handler that handles calls from the JS WebUI code to get the details 62 // Dialog handler that handles calls from the JS WebUI code to get the details
97 // of the list of frozen tabs. 63 // of the list of frozen tabs.
98 class HungRendererDialogHandler : public WebUIMessageHandler { 64 class HungRendererDialogHandler : public WebUIMessageHandler {
99 public: 65 public:
100 explicit HungRendererDialogHandler(TabContents* contents); 66 explicit HungRendererDialogHandler(TabContents* contents);
101 67
102 void CloseDialog(); 68 void CloseDialog();
103 69
104 // Overridden from WebUIMessageHandler 70 // Overridden from WebUIMessageHandler
105 virtual void RegisterMessages(); 71 virtual void RegisterMessages();
106 72
107 private: 73 private:
108 void RequestTabContentsList(const base::ListValue* args); 74 void RequestTabContentsList(const base::ListValue* args);
109 75
110 // The tab contents. 76 // The tab contents.
111 TabContents* contents_; 77 TabContents* contents_;
112 78
113 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); 79 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler);
114 }; 80 };
115 81
116 82
117 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ 83 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
118 84
OLDNEW
« no previous file with comments | « chrome/browser/resources/hung_renderer_dialog.js ('k') | chrome/browser/ui/webui/hung_renderer_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698