| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/platform_util.h" | 8 #include "chrome/browser/platform_util.h" |
| 9 #include "chrome/browser/ui/views/constrained_window_views.h" | 9 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 10 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 views::Widget* widget = GetWidget(dialog); | 70 views::Widget* widget = GetWidget(dialog); |
| 71 widget->AddObserver(this); | 71 widget->AddObserver(this); |
| 72 observed_widgets_.insert(widget); | 72 observed_widgets_.insert(widget); |
| 73 widget->set_movement_disabled(true); | 73 widget->set_movement_disabled(true); |
| 74 | 74 |
| 75 #if defined(USE_AURA) | 75 #if defined(USE_AURA) |
| 76 // TODO(wittman): remove once the new visual style is complete | 76 // TODO(wittman): remove once the new visual style is complete |
| 77 widget->GetNativeWindow()->SetProperty(aura::client::kConstrainedWindowKey, | 77 widget->GetNativeWindow()->SetProperty(aura::client::kConstrainedWindowKey, |
| 78 true); | 78 true); |
| 79 | 79 |
| 80 views::corewm::SetWindowVisibilityAnimationType( | 80 wm::SetWindowVisibilityAnimationType( |
| 81 widget->GetNativeWindow(), | 81 widget->GetNativeWindow(), |
| 82 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); | 82 wm::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #if defined(USE_ASH) | 85 #if defined(USE_ASH) |
| 86 gfx::NativeView parent = platform_util::GetParent(widget->GetNativeView()); | 86 gfx::NativeView parent = platform_util::GetParent(widget->GetNativeView()); |
| 87 views::corewm::SetChildWindowVisibilityChangesAnimated(parent); | 87 wm::SetChildWindowVisibilityChangesAnimated(parent); |
| 88 // No animations should get performed on the window since that will re-order | 88 // No animations should get performed on the window since that will re-order |
| 89 // the window stack which will then cause many problems. | 89 // the window stack which will then cause many problems. |
| 90 if (parent && parent->parent()) { | 90 if (parent && parent->parent()) { |
| 91 parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, true); | 91 parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, true); |
| 92 } | 92 } |
| 93 | 93 |
| 94 views::corewm::SetModalParent( | 94 wm::SetModalParent( |
| 95 widget->GetNativeWindow(), | 95 widget->GetNativeWindow(), |
| 96 platform_util::GetParent(widget->GetNativeView())); | 96 platform_util::GetParent(widget->GetNativeView())); |
| 97 #endif | 97 #endif |
| 98 } | 98 } |
| 99 | 99 |
| 100 virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 100 virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
| 101 views::Widget* widget = GetWidget(dialog); | 101 views::Widget* widget = GetWidget(dialog); |
| 102 #if defined(USE_AURA) | 102 #if defined(USE_AURA) |
| 103 scoped_ptr<views::corewm::SuspendChildWindowVisibilityAnimations> suspend; | 103 scoped_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend; |
| 104 if (shown_widgets_.find(widget) != shown_widgets_.end()) { | 104 if (shown_widgets_.find(widget) != shown_widgets_.end()) { |
| 105 suspend.reset(new views::corewm::SuspendChildWindowVisibilityAnimations( | 105 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations( |
| 106 widget->GetNativeWindow()->parent())); | 106 widget->GetNativeWindow()->parent())); |
| 107 } | 107 } |
| 108 #endif | 108 #endif |
| 109 // Host may be NULL during tab drag on Views/Win32. | 109 // Host may be NULL during tab drag on Views/Win32. |
| 110 if (host_) | 110 if (host_) |
| 111 UpdateWebContentsModalDialogPosition(widget, host_); | 111 UpdateWebContentsModalDialogPosition(widget, host_); |
| 112 widget->Show(); | 112 widget->Show(); |
| 113 FocusDialog(dialog); | 113 FocusDialog(dialog); |
| 114 | 114 |
| 115 #if defined(USE_AURA) | 115 #if defined(USE_AURA) |
| 116 // TODO(pkotwicz): Control the z-order of the constrained dialog via | 116 // TODO(pkotwicz): Control the z-order of the constrained dialog via |
| 117 // views::kHostViewKey. We will need to ensure that the parent window's | 117 // views::kHostViewKey. We will need to ensure that the parent window's |
| 118 // shadows are below the constrained dialog in z-order when we do this. | 118 // shadows are below the constrained dialog in z-order when we do this. |
| 119 shown_widgets_.insert(widget); | 119 shown_widgets_.insert(widget); |
| 120 #endif | 120 #endif |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual void HideDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 123 virtual void HideDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
| 124 views::Widget* widget = GetWidget(dialog); | 124 views::Widget* widget = GetWidget(dialog); |
| 125 #if defined(USE_AURA) | 125 #if defined(USE_AURA) |
| 126 scoped_ptr<views::corewm::SuspendChildWindowVisibilityAnimations> suspend; | 126 scoped_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend; |
| 127 suspend.reset(new views::corewm::SuspendChildWindowVisibilityAnimations( | 127 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations( |
| 128 widget->GetNativeWindow()->parent())); | 128 widget->GetNativeWindow()->parent())); |
| 129 #endif | 129 #endif |
| 130 widget->Hide(); | 130 widget->Hide(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 virtual void CloseDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 133 virtual void CloseDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
| 134 GetWidget(dialog)->Close(); | 134 GetWidget(dialog)->Close(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void FocusDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 137 virtual void FocusDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 namespace web_modal { | 240 namespace web_modal { |
| 241 | 241 |
| 242 NativeWebContentsModalDialogManager* WebContentsModalDialogManager:: | 242 NativeWebContentsModalDialogManager* WebContentsModalDialogManager:: |
| 243 CreateNativeManager( | 243 CreateNativeManager( |
| 244 NativeWebContentsModalDialogManagerDelegate* native_delegate) { | 244 NativeWebContentsModalDialogManagerDelegate* native_delegate) { |
| 245 return new NativeWebContentsModalDialogManagerViews(native_delegate); | 245 return new NativeWebContentsModalDialogManagerViews(native_delegate); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace web_modal | 248 } // namespace web_modal |
| OLD | NEW |