blob: e26a8a13a4a92d438076b05fd3ac9b31c4f8cc3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2011 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_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
#define CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
#pragma once
#include <string>
#include <vector>
#include "base/string16.h"
#include "base/values.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "ui/gfx/native_widget_types.h"
class TabContents;
class HungRendererDialogHandler;
class HungRendererDialog : private HtmlDialogUIDelegate {
public:
// Shows a hung renderer dialog.
static void ShowHungRendererDialog(TabContents* contents);
// Hides a hung renderer dialog.
static void HideHungRendererDialog(TabContents* contents);
private:
HungRendererDialog();
// Shows the hung renderer dialog.
void ShowDialog(TabContents* contents);
// Hides the hung renderer dialog.
void HideDialog(TabContents* contents);
// HtmlDialogUIDelegate methods
virtual bool IsDialogModal() const OVERRIDE;
virtual string16 GetDialogTitle() const OVERRIDE;
virtual GURL GetDialogContentURL() const OVERRIDE;
virtual void GetWebUIMessageHandlers(
std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
virtual std::string GetDialogArgs() const OVERRIDE;
virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
virtual void OnCloseContents(TabContents* source,
bool* out_close_dialog) OVERRIDE;
virtual bool ShouldShowDialogTitle() const OVERRIDE;
// The tab contents.
TabContents* contents_;
// The dialog handler.
HungRendererDialogHandler* handler_;
// The dialog window.
gfx::NativeWindow window_;
DISALLOW_COPY_AND_ASSIGN(HungRendererDialog);
};
// Dialog handler that handles calls from the JS WebUI code to get the details
// of the list of frozen tabs.
class HungRendererDialogHandler : public WebUIMessageHandler {
public:
explicit HungRendererDialogHandler(TabContents* contents);
void CloseDialog();
// Overridden from WebUIMessageHandler
virtual void RegisterMessages();
private:
void RequestTabContentsList(const base::ListValue* args);
// The tab contents.
TabContents* contents_;
DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler);
};
#endif // CHROME_BROWSER_UI_WEBUI_HUNG_RENDERER_DIALOG_H_
|