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

Side by Side Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 797413002: MacViews: Compile more Views source files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for sky and rebase Created 6 years 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) 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 #include "chrome/browser/ui/views/hung_renderer_view.h" 5 #include "chrome/browser/ui/views/hung_renderer_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Padding space in pixels between frozen icon to the info label, hung pages 167 // Padding space in pixels between frozen icon to the info label, hung pages
168 // list table view and the Kill pages button. 168 // list table view and the Kill pages button.
169 static const int kCentralColumnPadding = 169 static const int kCentralColumnPadding =
170 views::kUnrelatedControlLargeHorizontalSpacing; 170 views::kUnrelatedControlLargeHorizontalSpacing;
171 171
172 /////////////////////////////////////////////////////////////////////////////// 172 ///////////////////////////////////////////////////////////////////////////////
173 // HungRendererDialogView, public: 173 // HungRendererDialogView, public:
174 174
175 // static 175 // static
176 HungRendererDialogView* HungRendererDialogView::Create( 176 HungRendererDialogView* HungRendererDialogView::Create(
177 gfx::NativeView context) { 177 gfx::NativeWindow context) {
178 if (!g_instance_) { 178 if (!g_instance_) {
179 g_instance_ = new HungRendererDialogView; 179 g_instance_ = new HungRendererDialogView;
180 views::DialogDelegate::CreateDialogWidget(g_instance_, context, NULL); 180 views::DialogDelegate::CreateDialogWidget(g_instance_, context, NULL);
181 } 181 }
182 return g_instance_; 182 return g_instance_;
183 } 183 }
184 184
185 // static 185 // static
186 HungRendererDialogView* HungRendererDialogView::GetInstance() { 186 HungRendererDialogView* HungRendererDialogView::GetInstance() {
187 return g_instance_; 187 return g_instance_;
188 } 188 }
189 189
190 // static 190 // static
191 bool HungRendererDialogView::IsFrameActive(WebContents* contents) { 191 bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
192 gfx::NativeView frame_view = 192 gfx::NativeWindow window =
193 platform_util::GetTopLevel(contents->GetNativeView()); 193 platform_util::GetTopLevel(contents->GetNativeView());
194 return platform_util::IsWindowActive(frame_view); 194 return platform_util::IsWindowActive(window);
195 } 195 }
196 196
197 // static 197 // static
198 void HungRendererDialogView::KillRendererProcess( 198 void HungRendererDialogView::KillRendererProcess(
199 content::RenderProcessHost* rph) { 199 content::RenderProcessHost* rph) {
200 #if defined(OS_WIN) 200 #if defined(OS_WIN)
201 // Try to generate a crash report for the hung process. 201 // Try to generate a crash report for the hung process.
202 CrashDumpAndTerminateHungChildProcess(rph->GetHandle()); 202 CrashDumpAndTerminateHungChildProcess(rph->GetHandle());
203 #else 203 #else
204 rph->Shutdown(content::RESULT_CODE_HUNG, false); 204 rph->Shutdown(content::RESULT_CODE_HUNG, false);
(...skipping 24 matching lines...) Expand all
229 229
230 if (!GetWidget()->IsActive()) { 230 if (!GetWidget()->IsActive()) {
231 // Place the dialog over content's browser window, similar to modal dialogs. 231 // Place the dialog over content's browser window, similar to modal dialogs.
232 Browser* browser = chrome::FindBrowserWithWebContents(contents); 232 Browser* browser = chrome::FindBrowserWithWebContents(contents);
233 if (browser) { 233 if (browser) {
234 ChromeWebModalDialogManagerDelegate* manager = browser; 234 ChromeWebModalDialogManagerDelegate* manager = browser;
235 constrained_window::UpdateWidgetModalDialogPosition( 235 constrained_window::UpdateWidgetModalDialogPosition(
236 GetWidget(), manager->GetWebContentsModalDialogHost()); 236 GetWidget(), manager->GetWebContentsModalDialogHost());
237 } 237 }
238 238
239 gfx::NativeView frame_view = 239 gfx::NativeWindow window =
240 platform_util::GetTopLevel(contents->GetNativeView()); 240 platform_util::GetTopLevel(contents->GetNativeView());
241 views::Widget* insert_after = 241 views::Widget* insert_after =
242 views::Widget::GetWidgetForNativeView(frame_view); 242 views::Widget::GetWidgetForNativeWindow(window);
243 if (insert_after) 243 if (insert_after)
244 GetWidget()->StackAboveWidget(insert_after); 244 GetWidget()->StackAboveWidget(insert_after);
245 245
246 #if defined(OS_WIN) 246 #if defined(OS_WIN)
247 // Group the hung renderer dialog with the browsers with the same profile. 247 // Group the hung renderer dialog with the browsers with the same profile.
248 Profile* profile = 248 Profile* profile =
249 Profile::FromBrowserContext(contents->GetBrowserContext()); 249 Profile::FromBrowserContext(contents->GetBrowserContext());
250 ui::win::SetAppIdForWindow( 250 ui::win::SetAppIdForWindow(
251 ShellIntegration::GetChromiumModelIdForProfile(profile->GetPath()), 251 ShellIntegration::GetChromiumModelIdForProfile(profile->GetPath()),
252 views::HWNDForWidget(GetWidget())); 252 views::HWNDForWidget(GetWidget()));
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 initialized = true; 423 initialized = true;
424 } 424 }
425 } 425 }
426 426
427 namespace chrome { 427 namespace chrome {
428 428
429 void ShowHungRendererDialog(WebContents* contents) { 429 void ShowHungRendererDialog(WebContents* contents) {
430 if (logging::DialogsAreSuppressed()) 430 if (logging::DialogsAreSuppressed())
431 return; 431 return;
432 432
433 gfx::NativeView toplevel_view = 433 gfx::NativeWindow window =
434 platform_util::GetTopLevel(contents->GetNativeView()); 434 platform_util::GetTopLevel(contents->GetNativeView());
435 #if defined(USE_AURA)
435 // Don't show the dialog if there is no root window for the renderer, because 436 // Don't show the dialog if there is no root window for the renderer, because
436 // it's invisible to the user (happens when the renderer is for prerendering 437 // it's invisible to the user (happens when the renderer is for prerendering
437 // for example). 438 // for example).
438 if (!toplevel_view->GetRootWindow()) 439 if (!window->GetRootWindow())
439 return; 440 return;
440 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view); 441 #endif
442 HungRendererDialogView* view = HungRendererDialogView::Create(window);
441 view->ShowForWebContents(contents); 443 view->ShowForWebContents(contents);
442 } 444 }
443 445
444 void HideHungRendererDialog(WebContents* contents) { 446 void HideHungRendererDialog(WebContents* contents) {
445 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance()) 447 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance())
446 HungRendererDialogView::GetInstance()->EndForWebContents(contents); 448 HungRendererDialogView::GetInstance()->EndForWebContents(contents);
447 } 449 }
448 450
449 } // namespace chrome 451 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698