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

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

Issue 8462015: Tests for WebUI Hung Renderer Dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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
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/string16.h" 12 #include "base/string16.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/ui/webui/html_dialog_ui.h" 14 #include "chrome/browser/ui/webui/html_dialog_ui.h"
15 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
16 16
17 class TabContents; 17 class TabContents;
18 class HungRendererDialogHandler; 18 class HungRendererDialogHandler;
19 19
20 class HungRendererDialog : private HtmlDialogUIDelegate { 20 class HungRendererDialog : private HtmlDialogUIDelegate {
21 public: 21 public:
22 // Shows a hung renderer dialog. 22 // Shows a hung renderer dialog.
23 static void ShowHungRendererDialog(TabContents* contents); 23 static void ShowHungRendererDialog(TabContents* contents, bool is_enabled);
flackr 2011/11/10 16:49:00 Don't include the testing paramter in the public n
wyck 2011/11/11 04:15:52 Done.
24 24
25 // Hides a hung renderer dialog. 25 // Hides a hung renderer dialog.
26 static void HideHungRendererDialog(TabContents* contents); 26 static void HideHungRendererDialog(TabContents* contents);
27 27
28 private: 28 private:
29 HungRendererDialog(); 29 explicit HungRendererDialog(bool is_enabled);
30 30
31 // Shows the hung renderer dialog. 31 // Shows the hung renderer dialog.
32 void ShowDialog(TabContents* contents); 32 void ShowDialog(TabContents* contents);
33 33
34 // Hides the hung renderer dialog. 34 // Hides the hung renderer dialog.
35 void HideDialog(TabContents* contents); 35 void HideDialog(TabContents* contents);
36 36
37 // HtmlDialogUIDelegate methods 37 // HtmlDialogUIDelegate methods
38 virtual bool IsDialogModal() const OVERRIDE; 38 virtual bool IsDialogModal() const OVERRIDE;
39 virtual string16 GetDialogTitle() const OVERRIDE; 39 virtual string16 GetDialogTitle() const OVERRIDE;
40 virtual GURL GetDialogContentURL() const OVERRIDE; 40 virtual GURL GetDialogContentURL() const OVERRIDE;
41 virtual void GetWebUIMessageHandlers( 41 virtual void GetWebUIMessageHandlers(
42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; 42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
44 virtual std::string GetDialogArgs() const OVERRIDE; 44 virtual std::string GetDialogArgs() const OVERRIDE;
45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
46 virtual void OnCloseContents(TabContents* source, 46 virtual void OnCloseContents(TabContents* source,
47 bool* out_close_dialog) OVERRIDE; 47 bool* out_close_dialog) OVERRIDE;
48 virtual bool ShouldShowDialogTitle() const OVERRIDE; 48 virtual bool ShouldShowDialogTitle() const OVERRIDE;
49 49
50 // The tab contents. 50 // The tab contents.
51 TabContents* contents_; 51 TabContents* contents_;
52 52
53 // The dialog handler. 53 // The dialog handler.
54 HungRendererDialogHandler* handler_; 54 HungRendererDialogHandler* handler_;
55 55
56 // A safety switch that must be enabled to allow actual killing of processes
57 // or restarting of the hang timer. This is necessary so that tests can
58 // create a disabled version of this dialog that won't kill processes or
59 // restart timers when the dialog closes at the end of the test.
60 bool is_enabled_;
61
56 // The dialog window. 62 // The dialog window.
57 gfx::NativeWindow window_; 63 gfx::NativeWindow window_;
58 64
59 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); 65 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog);
60 }; 66 };
61 67
62 // Dialog handler that handles calls from the JS WebUI code to get the details 68 // Dialog handler that handles calls from the JS WebUI code to get the details
63 // of the list of frozen tabs. 69 // of the list of frozen tabs.
64 class HungRendererDialogHandler : public WebUIMessageHandler { 70 class HungRendererDialogHandler : public WebUIMessageHandler {
65 public: 71 public:
66 explicit HungRendererDialogHandler(TabContents* contents); 72 explicit HungRendererDialogHandler(TabContents* contents);
67 73
68 void CloseDialog(); 74 void CloseDialog();
69 75
70 // Overridden from WebUIMessageHandler 76 // Overridden from WebUIMessageHandler
71 virtual void RegisterMessages(); 77 virtual void RegisterMessages();
72 78
73 private: 79 private:
74 void RequestTabContentsList(const base::ListValue* args); 80 void RequestTabContentsList(const base::ListValue* args);
75 81
76 // The tab contents. 82 // The tab contents.
77 TabContents* contents_; 83 TabContents* contents_;
78 84
79 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); 85 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler);
80 }; 86 };
81 87
82 88
83 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ 89 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
84 90
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