OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_HUNG_RENDERER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // This class displays a dialog which contains information about a hung | 93 // This class displays a dialog which contains information about a hung |
94 // renderer process. | 94 // renderer process. |
95 class HungRendererDialogView : public views::DialogDelegateView, | 95 class HungRendererDialogView : public views::DialogDelegateView, |
96 public views::ButtonListener, | 96 public views::ButtonListener, |
97 public HungPagesTableModel::Delegate { | 97 public HungPagesTableModel::Delegate { |
98 public: | 98 public: |
99 // Factory function for creating an instance of the HungRendererDialogView | 99 // Factory function for creating an instance of the HungRendererDialogView |
100 // class. At any given point only one instance can be active. | 100 // class. At any given point only one instance can be active. |
101 static HungRendererDialogView* Create(); | 101 static HungRendererDialogView* Create(); |
| 102 |
102 // Returns a pointer to the singleton instance if any. | 103 // Returns a pointer to the singleton instance if any. |
103 static HungRendererDialogView* GetInstance(); | 104 static HungRendererDialogView* GetInstance(); |
104 | 105 |
| 106 // Platform specific function to kill the renderer process identified by the |
| 107 // handle passed in. |
| 108 static void KillRendererProcess(base::ProcessHandle process_handle); |
| 109 |
| 110 // Returns true if the frame is in the foreground. |
| 111 static bool IsFrameActive(WebContents* contents); |
| 112 |
105 virtual void ShowForWebContents(WebContents* contents); | 113 virtual void ShowForWebContents(WebContents* contents); |
106 virtual void EndForWebContents(WebContents* contents); | 114 virtual void EndForWebContents(WebContents* contents); |
107 | 115 |
108 // views::DialogDelegateView overrides: | 116 // views::DialogDelegateView overrides: |
109 virtual string16 GetWindowTitle() const OVERRIDE; | 117 virtual string16 GetWindowTitle() const OVERRIDE; |
110 virtual void WindowClosing() OVERRIDE; | 118 virtual void WindowClosing() OVERRIDE; |
111 virtual int GetDialogButtons() const OVERRIDE; | 119 virtual int GetDialogButtons() const OVERRIDE; |
112 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 120 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
113 virtual views::View* GetExtraView() OVERRIDE; | 121 virtual views::View* GetExtraView() OVERRIDE; |
114 virtual bool Accept(bool window_closing) OVERRIDE; | 122 virtual bool Accept(bool window_closing) OVERRIDE; |
115 virtual views::View* GetContentsView() OVERRIDE; | 123 virtual views::View* GetContentsView() OVERRIDE; |
116 | 124 |
117 // views::ButtonListener overrides: | 125 // views::ButtonListener overrides: |
118 virtual void ButtonPressed(views::Button* sender, | 126 virtual void ButtonPressed(views::Button* sender, |
119 const views::Event& event) OVERRIDE; | 127 const views::Event& event) OVERRIDE; |
120 | 128 |
121 // HungPagesTableModel::Delegate overrides: | 129 // HungPagesTableModel::Delegate overrides: |
122 virtual void TabDestroyed() OVERRIDE; | 130 virtual void TabDestroyed() OVERRIDE; |
123 | 131 |
124 protected: | 132 protected: |
125 HungRendererDialogView(); | 133 HungRendererDialogView(); |
126 virtual ~HungRendererDialogView(); | 134 virtual ~HungRendererDialogView(); |
127 | 135 |
128 // views::View overrides: | 136 // views::View overrides: |
129 virtual void ViewHierarchyChanged(bool is_add, | 137 virtual void ViewHierarchyChanged(bool is_add, |
130 views::View* parent, | 138 views::View* parent, |
131 views::View* child) OVERRIDE; | 139 views::View* child) OVERRIDE; |
132 | 140 |
133 // Returns true if the frame is in the foreground. | |
134 bool IsFrameActive(WebContents* contents); | |
135 | |
136 static HungRendererDialogView* g_instance_; | 141 static HungRendererDialogView* g_instance_; |
137 | 142 |
138 private: | 143 private: |
139 // Initialize the controls in this dialog. | 144 // Initialize the controls in this dialog. |
140 void Init(); | 145 void Init(); |
141 void CreateKillButtonView(); | 146 void CreateKillButtonView(); |
142 | 147 |
143 // Returns the bounds the dialog should be displayed at to be meaningfully | 148 // Returns the bounds the dialog should be displayed at to be meaningfully |
144 // associated with the specified WebContents. | 149 // associated with the specified WebContents. |
145 gfx::Rect GetDisplayBounds(WebContents* contents); | 150 gfx::Rect GetDisplayBounds(WebContents* contents); |
(...skipping 16 matching lines...) Expand all Loading... |
162 // Whether or not we've created controls for ourself. | 167 // Whether or not we've created controls for ourself. |
163 bool initialized_; | 168 bool initialized_; |
164 | 169 |
165 // An amusing icon image. | 170 // An amusing icon image. |
166 static gfx::ImageSkia* frozen_icon_; | 171 static gfx::ImageSkia* frozen_icon_; |
167 | 172 |
168 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); | 173 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); |
169 }; | 174 }; |
170 | 175 |
171 #endif // CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ | 176 #endif // CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_H_ |
OLD | NEW |