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.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" |
11 #include "chrome/browser/platform_util.h" | 11 #include "chrome/browser/platform_util.h" |
12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" | 14 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" |
15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
17 #include "chrome/browser/ui/views/constrained_window_views.h" | |
18 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/logging_chrome.h" | 18 #include "chrome/common/logging_chrome.h" |
20 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "components/constrained_window/constrained_window_views.h" |
21 #include "components/web_modal/web_contents_modal_dialog_host.h" | 21 #include "components/web_modal/web_contents_modal_dialog_host.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
26 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
27 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/canvas.h" | 30 #include "ui/gfx/canvas.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // application selected, activating ourselves is rude. | 225 // application selected, activating ourselves is rude. |
226 if (!IsFrameActive(contents) && | 226 if (!IsFrameActive(contents) && |
227 !platform_util::IsWindowActive(GetWidget()->GetNativeWindow())) | 227 !platform_util::IsWindowActive(GetWidget()->GetNativeWindow())) |
228 return; | 228 return; |
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 UpdateBrowserModalDialogPosition( | 235 UpdateWidgetModalDialogPosition( |
236 GetWidget(), manager->GetWebContentsModalDialogHost()); | 236 GetWidget(), manager->GetWebContentsModalDialogHost()); |
237 } | 237 } |
238 | 238 |
239 gfx::NativeView frame_view = | 239 gfx::NativeView frame_view = |
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::GetWidgetForNativeView(frame_view); |
243 if (insert_after) | 243 if (insert_after) |
244 GetWidget()->StackAboveWidget(insert_after); | 244 GetWidget()->StackAboveWidget(insert_after); |
245 | 245 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view); | 442 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view); |
443 view->ShowForWebContents(contents); | 443 view->ShowForWebContents(contents); |
444 } | 444 } |
445 | 445 |
446 void HideHungRendererDialog(WebContents* contents) { | 446 void HideHungRendererDialog(WebContents* contents) { |
447 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance()) | 447 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance()) |
448 HungRendererDialogView::GetInstance()->EndForWebContents(contents); | 448 HungRendererDialogView::GetInstance()->EndForWebContents(contents); |
449 } | 449 } |
450 | 450 |
451 } // namespace chrome | 451 } // namespace chrome |
OLD | NEW |