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

Unified Diff: components/constrained_window/native_web_contents_modal_dialog_manager_views.cc

Issue 2087643003: Move web modal dialog manager files into the constrained_window component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase? Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
diff --git a/chrome/browser/ui/views/native_web_contents_modal_dialog_manager_views.cc b/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
similarity index 92%
rename from chrome/browser/ui/views/native_web_contents_modal_dialog_manager_views.cc
rename to components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
index 9894085a151844d9710fa30b7e3c4bbe1dbb68b1..45e3a43e49088650c3d330cc1b27303e6fcf5329 100644
--- a/chrome/browser/ui/views/native_web_contents_modal_dialog_manager_views.cc
+++ b/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/views/native_web_contents_modal_dialog_manager_views.h"
+#include "components/constrained_window/native_web_contents_modal_dialog_manager_views.h"
#include <memory>
-#include "chrome/browser/platform_util.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
@@ -31,6 +30,8 @@ using web_modal::SingleWebContentsDialogManagerDelegate;
using web_modal::WebContentsModalDialogHost;
using web_modal::ModalDialogHostObserver;
+namespace constrained_window {
+
NativeWebContentsModalDialogManagerViews::
NativeWebContentsModalDialogManagerViews(
gfx::NativeWindow dialog,
@@ -67,7 +68,7 @@ void NativeWebContentsModalDialogManagerViews::ManageDialog() {
wm::SetWindowVisibilityAnimationType(
widget->GetNativeWindow(), wm::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE);
- gfx::NativeView parent = platform_util::GetParent(widget->GetNativeView());
+ gfx::NativeView parent = widget->GetNativeView()->parent();
wm::SetChildWindowVisibilityChangesAnimated(parent);
// No animations should get performed on the window since that will re-order
// the window stack which will then cause many problems.
@@ -97,10 +98,7 @@ void NativeWebContentsModalDialogManagerViews::Show() {
widget->GetNativeWindow()->parent()));
}
#endif
- // Host may be NULL during tab drag on Views/Win32.
- if (host_)
- constrained_window::UpdateWebContentsModalDialogPosition(widget, host_);
- widget->Show();
+ ShowWidget(widget);
Focus();
#if defined(USE_AURA)
@@ -118,7 +116,7 @@ void NativeWebContentsModalDialogManagerViews::Hide() {
suspend.reset(new wm::SuspendChildWindowVisibilityAnimations(
widget->GetNativeWindow()->parent()));
#endif
- widget->Hide();
+ HideWidget(widget);
}
void NativeWebContentsModalDialogManagerViews::Close() {
@@ -193,6 +191,19 @@ gfx::NativeWindow NativeWebContentsModalDialogManagerViews::dialog() {
return dialog_;
}
+void NativeWebContentsModalDialogManagerViews::ShowWidget(
+ views::Widget* widget) {
+ // |host_| may be NULL during tab drag on Views/Win32.
+ if (host_)
+ constrained_window::UpdateWebContentsModalDialogPosition(widget, host_);
+ widget->Show();
+}
+
+void NativeWebContentsModalDialogManagerViews::HideWidget(
+ views::Widget* widget) {
+ widget->Hide();
+}
+
views::Widget* NativeWebContentsModalDialogManagerViews::GetWidget(
gfx::NativeWindow dialog) {
views::Widget* widget = views::Widget::GetWidgetForNativeWindow(dialog);
@@ -203,7 +214,7 @@ views::Widget* NativeWebContentsModalDialogManagerViews::GetWidget(
void NativeWebContentsModalDialogManagerViews::WidgetClosing(
views::Widget* widget) {
#if defined(USE_AURA)
- gfx::NativeView view = platform_util::GetParent(widget->GetNativeView());
+ gfx::NativeView view = widget->GetNativeView()->parent();
// Allow the parent to animate again.
if (view && view->parent())
view->parent()->ClearProperty(aura::client::kAnimationsDisabledKey);
@@ -218,3 +229,5 @@ void NativeWebContentsModalDialogManagerViews::WidgetClosing(
// Will cause this object to be deleted.
native_delegate_->WillClose(widget->GetNativeWindow());
}
+
+} // namespace constrained_window

Powered by Google App Engine
This is Rietveld 408576698