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