| 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 #include "chrome/browser/ui/views/hung_renderer_view_win.h" | 5 #include "chrome/browser/ui/views/hung_renderer_view_win.h" |
| 6 | 6 |
| 7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
| 8 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" | 8 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" |
| 9 #include "chrome/browser/ui/views/hung_renderer_view.h" | 9 #include "chrome/browser/ui/views/hung_renderer_view.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "win8/util/win8_util.h" |
| 14 | 15 |
| 15 // Metro functions for displaying and dismissing a dialog box. | 16 // Metro functions for displaying and dismissing a dialog box. |
| 16 typedef void (*MetroShowDialogBox)( | 17 typedef void (*MetroShowDialogBox)( |
| 17 const wchar_t* title, | 18 const wchar_t* title, |
| 18 const wchar_t* content, | 19 const wchar_t* content, |
| 19 const wchar_t* button1_label, | 20 const wchar_t* button1_label, |
| 20 const wchar_t* button2_label, | 21 const wchar_t* button2_label, |
| 21 base::win::MetroDialogButtonPressedHandler button1_handler, | 22 base::win::MetroDialogButtonPressedHandler button1_handler, |
| 22 base::win::MetroDialogButtonPressedHandler button2_handler); | 23 base::win::MetroDialogButtonPressedHandler button2_handler); |
| 23 | 24 |
| 24 typedef void (*MetroDismissDialogBox)(); | 25 typedef void (*MetroDismissDialogBox)(); |
| 25 | 26 |
| 26 using content::BrowserThread; | 27 using content::BrowserThread; |
| 27 using content::WebContents; | 28 using content::WebContents; |
| 28 | 29 |
| 29 HungRendererDialogMetro* HungRendererDialogMetro::g_instance_ = NULL; | 30 HungRendererDialogMetro* HungRendererDialogMetro::g_instance_ = NULL; |
| 30 | 31 |
| 31 bool PlatformShowCustomHungRendererDialog(WebContents* contents) { | 32 bool PlatformShowCustomHungRendererDialog(WebContents* contents) { |
| 32 if (!base::win::IsMetroProcess()) | 33 if (!win8::IsSingleWindowMetroMode()) |
| 33 return false; | 34 return false; |
| 34 | 35 |
| 35 HungRendererDialogMetro::Create()->Show(contents); | 36 HungRendererDialogMetro::Create()->Show(contents); |
| 36 return true; | 37 return true; |
| 37 } | 38 } |
| 38 | 39 |
| 39 bool PlatformHideCustomHungRendererDialog(WebContents* contents) { | 40 bool PlatformHideCustomHungRendererDialog(WebContents* contents) { |
| 40 if (!base::win::IsMetroProcess()) | 41 if (!win8::IsSingleWindowMetroMode()) |
| 41 return false; | 42 return false; |
| 42 | 43 |
| 43 if (HungRendererDialogMetro::GetInstance()) | 44 if (HungRendererDialogMetro::GetInstance()) |
| 44 HungRendererDialogMetro::GetInstance()->Hide(contents); | 45 HungRendererDialogMetro::GetInstance()->Hide(contents); |
| 45 return true; | 46 return true; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // static | 49 // static |
| 49 void HungRendererDialogView::KillRendererProcess( | 50 void HungRendererDialogView::KillRendererProcess( |
| 50 base::ProcessHandle process_handle) { | 51 base::ProcessHandle process_handle) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 base::Bind(HungRendererDialogMetro::OnMetroWait)); | 162 base::Bind(HungRendererDialogMetro::OnMetroWait)); |
| 162 return; | 163 return; |
| 163 } | 164 } |
| 164 | 165 |
| 165 // Its possible that we got deleted in the meantime. | 166 // Its possible that we got deleted in the meantime. |
| 166 if (!GetInstance()) | 167 if (!GetInstance()) |
| 167 return; | 168 return; |
| 168 | 169 |
| 169 GetInstance()->ResetMetroState(); | 170 GetInstance()->ResetMetroState(); |
| 170 } | 171 } |
| OLD | NEW |