| 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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 | 738 |
| 739 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 739 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
| 740 }; | 740 }; |
| 741 | 741 |
| 742 //////////////////////////////////////////////////////////////////////////////// | 742 //////////////////////////////////////////////////////////////////////////////// |
| 743 // WebContentsViewAura, public: | 743 // WebContentsViewAura, public: |
| 744 | 744 |
| 745 WebContentsViewAura::WebContentsViewAura( | 745 WebContentsViewAura::WebContentsViewAura( |
| 746 WebContentsImpl* web_contents, | 746 WebContentsImpl* web_contents, |
| 747 WebContentsViewDelegate* delegate) | 747 WebContentsViewDelegate* delegate) |
| 748 : web_contents_(web_contents), | 748 : WebContentsObserver(web_contents), |
| 749 web_contents_(web_contents), |
| 749 delegate_(delegate), | 750 delegate_(delegate), |
| 750 current_drag_op_(blink::WebDragOperationNone), | 751 current_drag_op_(blink::WebDragOperationNone), |
| 751 drag_dest_delegate_(NULL), | 752 drag_dest_delegate_(NULL), |
| 752 current_rvh_for_drag_(NULL), | 753 current_rvh_for_drag_(NULL), |
| 753 overscroll_change_brightness_(false), | 754 overscroll_change_brightness_(false), |
| 754 current_overscroll_gesture_(OVERSCROLL_NONE), | 755 current_overscroll_gesture_(OVERSCROLL_NONE), |
| 755 completed_overscroll_gesture_(OVERSCROLL_NONE), | 756 completed_overscroll_gesture_(OVERSCROLL_NONE), |
| 756 touch_editable_(TouchEditableImplAura::Create()), | 757 touch_editable_(TouchEditableImplAura::Create()), |
| 757 is_or_was_visible_(false) { | 758 is_or_was_visible_(false) { |
| 758 } | 759 } |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 web_contents_->GetRenderViewHost()->DragTargetDrop( | 1640 web_contents_->GetRenderViewHost()->DragTargetDrop( |
| 1640 event.location(), | 1641 event.location(), |
| 1641 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1642 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
| 1642 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1643 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1643 if (drag_dest_delegate_) | 1644 if (drag_dest_delegate_) |
| 1644 drag_dest_delegate_->OnDrop(); | 1645 drag_dest_delegate_->OnDrop(); |
| 1645 current_drop_data_.reset(); | 1646 current_drop_data_.reset(); |
| 1646 return ConvertFromWeb(current_drag_op_); | 1647 return ConvertFromWeb(current_drag_op_); |
| 1647 } | 1648 } |
| 1648 | 1649 |
| 1650 void WebContentsViewAura::RenderProcessGone(base::TerminationStatus status) { |
| 1651 #if defined(OS_WIN) |
| 1652 UpdateLegacyHwndVisibility(); |
| 1653 #endif |
| 1654 } |
| 1655 |
| 1649 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1656 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
| 1650 bool visible) { | 1657 bool visible) { |
| 1651 // Ignore any visibility changes in the hierarchy below. | 1658 // Ignore any visibility changes in the hierarchy below. |
| 1652 if (window != window_.get() && window_->Contains(window)) | 1659 if (window != window_.get() && window_->Contains(window)) |
| 1653 return; | 1660 return; |
| 1654 | 1661 |
| 1655 UpdateWebContentsVisibility(visible); | 1662 UpdateWebContentsVisibility(visible); |
| 1656 } | 1663 } |
| 1657 | 1664 |
| 1658 void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { | 1665 void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1671 } | 1678 } |
| 1672 if (visible) { | 1679 if (visible) { |
| 1673 if (!web_contents_->should_normally_be_visible()) | 1680 if (!web_contents_->should_normally_be_visible()) |
| 1674 web_contents_->WasShown(); | 1681 web_contents_->WasShown(); |
| 1675 } else { | 1682 } else { |
| 1676 if (web_contents_->should_normally_be_visible()) | 1683 if (web_contents_->should_normally_be_visible()) |
| 1677 web_contents_->WasHidden(); | 1684 web_contents_->WasHidden(); |
| 1678 } | 1685 } |
| 1679 | 1686 |
| 1680 #if defined(OS_WIN) | 1687 #if defined(OS_WIN) |
| 1688 UpdateLegacyHwndVisibility(); |
| 1689 #endif |
| 1690 } |
| 1691 |
| 1692 #if defined(OS_WIN) |
| 1693 void WebContentsViewAura::UpdateLegacyHwndVisibility() { |
| 1681 if (!legacy_hwnd_) | 1694 if (!legacy_hwnd_) |
| 1682 return; | 1695 return; |
| 1683 | 1696 |
| 1697 bool visible = (window_->IsVisible() && |
| 1698 web_contents_->GetRenderWidgetHostView()); |
| 1699 |
| 1684 if (visible && GetNativeView() && GetNativeView()->GetHost()) { | 1700 if (visible && GetNativeView() && GetNativeView()->GetHost()) { |
| 1685 legacy_hwnd_->UpdateParent( | 1701 legacy_hwnd_->UpdateParent( |
| 1686 GetNativeView()->GetHost()->GetAcceleratedWidget()); | 1702 GetNativeView()->GetHost()->GetAcceleratedWidget()); |
| 1687 legacy_hwnd_->SetBounds(window_->GetBoundsInRootWindow()); | 1703 legacy_hwnd_->SetBounds(window_->GetBoundsInRootWindow()); |
| 1688 legacy_hwnd_->Show(); | 1704 legacy_hwnd_->Show(); |
| 1689 } else { | 1705 } else { |
| 1690 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | 1706 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global |
| 1691 // hidden window on the same lines as Windowed plugin windows. | 1707 // hidden window on the same lines as Windowed plugin windows. |
| 1692 legacy_hwnd_->UpdateParent(ui::GetHiddenWindow()); | 1708 legacy_hwnd_->UpdateParent(ui::GetHiddenWindow()); |
| 1693 legacy_hwnd_->Hide(); | 1709 legacy_hwnd_->Hide(); |
| 1694 } | 1710 } |
| 1695 #endif | |
| 1696 } | 1711 } |
| 1697 | 1712 |
| 1698 #if defined(OS_WIN) | |
| 1699 gfx::NativeViewAccessible | 1713 gfx::NativeViewAccessible |
| 1700 WebContentsViewAura::GetNativeViewAccessible() { | 1714 WebContentsViewAura::GetNativeViewAccessible() { |
| 1701 BrowserAccessibilityManager* manager = | 1715 BrowserAccessibilityManager* manager = |
| 1702 web_contents_->GetRootBrowserAccessibilityManager(); | 1716 web_contents_->GetRootBrowserAccessibilityManager(); |
| 1703 if (!manager) | 1717 if (!manager) |
| 1704 return nullptr; | 1718 return nullptr; |
| 1705 | 1719 |
| 1706 return manager->GetRoot()->ToBrowserAccessibilityWin(); | 1720 return manager->GetRoot()->ToBrowserAccessibilityWin(); |
| 1707 } | 1721 } |
| 1708 #endif | 1722 #endif |
| 1709 | 1723 |
| 1710 } // namespace content | 1724 } // namespace content |
| OLD | NEW |