OLD | NEW |
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 | 18 |
19 class HungRendererDialog : private HtmlDialogUIDelegate { | 19 class HungRendererDialog : private HtmlDialogUIDelegate { |
20 public: | 20 public: |
| 21 // Shows a hung renderer dialog. |
| 22 static void ShowHungRendererDialog(TabContents* contents); |
| 23 |
| 24 // Hides a hung renderer dialog. |
| 25 static void HideHungRendererDialog(TabContents* contents); |
| 26 |
| 27 private: |
21 HungRendererDialog(); | 28 HungRendererDialog(); |
22 | 29 |
23 // Shows the hung renderer dialog. | 30 // Shows the hung renderer dialog. |
24 void ShowDialog(gfx::NativeWindow owning_window, TabContents* contents); | 31 void ShowDialog(TabContents* contents); |
25 | 32 |
26 private: | 33 // Hides the hung renderer dialog. |
| 34 void HideDialog(TabContents* contents); |
| 35 |
27 // HtmlDialogUIDelegate methods | 36 // HtmlDialogUIDelegate methods |
28 virtual bool IsDialogModal() const OVERRIDE; | 37 virtual bool IsDialogModal() const OVERRIDE; |
29 virtual string16 GetDialogTitle() const OVERRIDE; | 38 virtual string16 GetDialogTitle() const OVERRIDE; |
30 virtual GURL GetDialogContentURL() const OVERRIDE; | 39 virtual GURL GetDialogContentURL() const OVERRIDE; |
31 virtual void GetWebUIMessageHandlers( | 40 virtual void GetWebUIMessageHandlers( |
32 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 41 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; |
33 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 42 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
34 virtual std::string GetDialogArgs() const OVERRIDE; | 43 virtual std::string GetDialogArgs() const OVERRIDE; |
35 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 44 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
36 virtual void OnCloseContents(TabContents* source, | 45 virtual void OnCloseContents(TabContents* source, |
37 bool* out_close_dialog) OVERRIDE; | 46 bool* out_close_dialog) OVERRIDE; |
38 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 47 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
39 | 48 |
40 // The tab contents. | 49 // The tab contents. |
41 TabContents* contents_; | 50 TabContents* contents_; |
42 | 51 |
| 52 // The dialog window. |
| 53 gfx::NativeWindow window_; |
| 54 |
43 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); | 55 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); |
44 }; | 56 }; |
45 | 57 |
46 // Dialog handler that handles calls from the JS WebUI code to get the details | 58 // Dialog handler that handles calls from the JS WebUI code to get the details |
47 // of the list of frozen tabs. | 59 // of the list of frozen tabs. |
48 class HungRendererDialogHandler : public WebUIMessageHandler { | 60 class HungRendererDialogHandler : public WebUIMessageHandler { |
49 public: | 61 public: |
50 explicit HungRendererDialogHandler(TabContents* contents); | 62 explicit HungRendererDialogHandler(TabContents* contents); |
51 | 63 |
52 // Overridden from WebUIMessageHandler | 64 // Overridden from WebUIMessageHandler |
53 virtual void RegisterMessages(); | 65 virtual void RegisterMessages(); |
54 | 66 |
55 private: | 67 private: |
56 void RequestTabContentsList(const base::ListValue* args); | 68 void RequestTabContentsList(const base::ListValue* args); |
57 | 69 |
58 // The tab contents. | 70 // The tab contents. |
59 TabContents* contents_; | 71 TabContents* contents_; |
60 | 72 |
61 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); | 73 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); |
62 }; | 74 }; |
63 | 75 |
64 | 76 |
65 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ | 77 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ |
| 78 |
OLD | NEW |