| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/native_web_contents_modal_dialog_manager_views
.h" | 5 #include "chrome/browser/ui/views/native_web_contents_modal_dialog_manager_views
.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "chrome/browser/platform_util.h" | 9 #include "chrome/browser/platform_util.h" |
| 10 #include "components/constrained_window/constrained_window_views.h" | 10 #include "components/constrained_window/constrained_window_views.h" |
| 11 #include "components/web_modal/web_contents_modal_dialog_host.h" | 11 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 12 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 12 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 13 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 15 #include "ui/views/border.h" | 15 #include "ui/views/border.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 18 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
| 19 #include "ui/views/window/non_client_view.h" | 19 #include "ui/views/window/non_client_view.h" |
| 20 | 20 |
| 21 #if defined(USE_AURA) | 21 #if defined(USE_AURA) |
| 22 #include "ui/aura/client/aura_constants.h" | 22 #include "ui/aura/client/aura_constants.h" |
| 23 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 24 #include "ui/aura/window_targeter.h" |
| 24 #include "ui/wm/core/visibility_controller.h" | 25 #include "ui/wm/core/visibility_controller.h" |
| 25 #include "ui/wm/core/window_animations.h" | 26 #include "ui/wm/core/window_animations.h" |
| 26 #include "ui/wm/core/window_modality_controller.h" | 27 #include "ui/wm/core/window_modality_controller.h" |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 using web_modal::SingleWebContentsDialogManager; | 30 using web_modal::SingleWebContentsDialogManager; |
| 30 using web_modal::SingleWebContentsDialogManagerDelegate; | 31 using web_modal::SingleWebContentsDialogManagerDelegate; |
| 31 using web_modal::WebContentsModalDialogHost; | 32 using web_modal::WebContentsModalDialogHost; |
| 32 using web_modal::ModalDialogHostObserver; | 33 using web_modal::ModalDialogHostObserver; |
| 33 | 34 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 gfx::NativeView parent = platform_util::GetParent(widget->GetNativeView()); | 71 gfx::NativeView parent = platform_util::GetParent(widget->GetNativeView()); |
| 71 wm::SetChildWindowVisibilityChangesAnimated(parent); | 72 wm::SetChildWindowVisibilityChangesAnimated(parent); |
| 72 // No animations should get performed on the window since that will re-order | 73 // No animations should get performed on the window since that will re-order |
| 73 // the window stack which will then cause many problems. | 74 // the window stack which will then cause many problems. |
| 74 if (parent && parent->parent()) { | 75 if (parent && parent->parent()) { |
| 75 parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, true); | 76 parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, true); |
| 76 } | 77 } |
| 77 | 78 |
| 78 wm::SetModalParent(widget->GetNativeWindow(), | 79 wm::SetModalParent(widget->GetNativeWindow(), |
| 79 native_delegate_->GetWebContents()->GetNativeView()); | 80 native_delegate_->GetWebContents()->GetNativeView()); |
| 81 #if defined(OS_CHROMEOS) |
| 82 if (native_delegate_->IsNonClipped(dialog())) { |
| 83 widget->SetNativeWindowProperty(aura::kHasIndependentBoundsKey, |
| 84 reinterpret_cast<void*>(true)); |
| 85 } |
| 86 #endif // OS_CHROMEOS |
| 80 #endif | 87 #endif |
| 81 } | 88 } |
| 82 | 89 |
| 83 // SingleWebContentsDialogManager: | 90 // SingleWebContentsDialogManager: |
| 84 | 91 |
| 85 void NativeWebContentsModalDialogManagerViews::Show() { | 92 void NativeWebContentsModalDialogManagerViews::Show() { |
| 86 // The host destroying means the dialogs will be destroyed in short order. | 93 // The host destroying means the dialogs will be destroyed in short order. |
| 87 // Avoid showing dialogs at this point as the necessary native window | 94 // Avoid showing dialogs at this point as the necessary native window |
| 88 // services may not be present. | 95 // services may not be present. |
| 89 if (host_destroying_) | 96 if (host_destroying_) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 widget->RemoveObserver(this); | 218 widget->RemoveObserver(this); |
| 212 observed_widgets_.erase(widget); | 219 observed_widgets_.erase(widget); |
| 213 | 220 |
| 214 #if defined(USE_AURA) | 221 #if defined(USE_AURA) |
| 215 shown_widgets_.erase(widget); | 222 shown_widgets_.erase(widget); |
| 216 #endif | 223 #endif |
| 217 | 224 |
| 218 // Will cause this object to be deleted. | 225 // Will cause this object to be deleted. |
| 219 native_delegate_->WillClose(widget->GetNativeWindow()); | 226 native_delegate_->WillClose(widget->GetNativeWindow()); |
| 220 } | 227 } |
| OLD | NEW |