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 class HungRendererDialogHandler; |
18 | 19 |
19 class HungRendererDialog : private HtmlDialogUIDelegate { | 20 class HungRendererDialog : private HtmlDialogUIDelegate { |
20 public: | 21 public: |
21 // Shows a hung renderer dialog. | 22 // Shows a hung renderer dialog. |
22 static void ShowHungRendererDialog(TabContents* contents); | 23 static void ShowHungRendererDialog(TabContents* contents); |
23 | 24 |
24 // Hides a hung renderer dialog. | 25 // Hides a hung renderer dialog. |
25 static void HideHungRendererDialog(TabContents* contents); | 26 static void HideHungRendererDialog(TabContents* contents); |
26 | 27 |
27 private: | 28 private: |
(...skipping 14 matching lines...) Expand all Loading... |
42 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
43 virtual std::string GetDialogArgs() const OVERRIDE; | 44 virtual std::string GetDialogArgs() const OVERRIDE; |
44 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
45 virtual void OnCloseContents(TabContents* source, | 46 virtual void OnCloseContents(TabContents* source, |
46 bool* out_close_dialog) OVERRIDE; | 47 bool* out_close_dialog) OVERRIDE; |
47 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 48 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
48 | 49 |
49 // The tab contents. | 50 // The tab contents. |
50 TabContents* contents_; | 51 TabContents* contents_; |
51 | 52 |
| 53 // The dialog handler. |
| 54 HungRendererDialogHandler* handler_; |
| 55 |
52 // The dialog window. | 56 // The dialog window. |
53 gfx::NativeWindow window_; | 57 gfx::NativeWindow window_; |
54 | 58 |
55 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); | 59 DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); |
56 }; | 60 }; |
57 | 61 |
58 // 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 |
59 // of the list of frozen tabs. | 63 // of the list of frozen tabs. |
60 class HungRendererDialogHandler : public WebUIMessageHandler { | 64 class HungRendererDialogHandler : public WebUIMessageHandler { |
61 public: | 65 public: |
62 explicit HungRendererDialogHandler(TabContents* contents); | 66 explicit HungRendererDialogHandler(TabContents* contents); |
63 | 67 |
| 68 void CloseDialog(); |
| 69 |
64 // Overridden from WebUIMessageHandler | 70 // Overridden from WebUIMessageHandler |
65 virtual void RegisterMessages(); | 71 virtual void RegisterMessages(); |
66 | 72 |
67 private: | 73 private: |
68 void RequestTabContentsList(const base::ListValue* args); | 74 void RequestTabContentsList(const base::ListValue* args); |
69 | 75 |
70 // The tab contents. | 76 // The tab contents. |
71 TabContents* contents_; | 77 TabContents* contents_; |
72 | 78 |
73 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); | 79 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); |
74 }; | 80 }; |
75 | 81 |
76 | 82 |
77 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ | 83 #endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_ |
78 | 84 |
OLD | NEW |