Chromium Code Reviews| 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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/browser/renderer_host/dip_util.h" | 10 #include "content/browser/renderer_host/dip_util.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 | 140 |
| 141 // aura::WindowDelegate implementation: | 141 // aura::WindowDelegate implementation: |
| 142 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 142 virtual gfx::Size GetMinimumSize() const OVERRIDE { |
| 143 return gfx::Size(); | 143 return gfx::Size(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 virtual gfx::Size GetMaximumSize() const OVERRIDE { | 146 virtual gfx::Size GetMaximumSize() const OVERRIDE { |
| 147 return gfx::Size(); | 147 return gfx::Size(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 virtual void SetHostTransitionBounds(const gfx::Rect& bounds) OVERRIDE { | |
| 151 } | |
| 152 | |
| 150 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 153 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 151 const gfx::Rect& new_bounds) OVERRIDE { | 154 const gfx::Rect& new_bounds) OVERRIDE { |
| 152 } | 155 } |
| 153 | 156 |
| 154 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { | 157 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { |
| 155 return gfx::kNullCursor; | 158 return gfx::kNullCursor; |
| 156 } | 159 } |
| 157 | 160 |
| 158 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { | 161 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { |
| 159 return HTNOWHERE; | 162 return HTNOWHERE; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 208 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { |
| 206 } | 209 } |
| 207 | 210 |
| 208 virtual void OnWindowDestroying() OVERRIDE { | 211 virtual void OnWindowDestroying() OVERRIDE { |
| 209 } | 212 } |
| 210 | 213 |
| 211 virtual void OnWindowDestroyed() OVERRIDE { | 214 virtual void OnWindowDestroyed() OVERRIDE { |
| 212 delete this; | 215 delete this; |
| 213 } | 216 } |
| 214 | 217 |
| 218 virtual void OnWindowHidingAnimationCompleted() OVERRIDE { | |
| 219 } | |
| 220 | |
| 215 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE { | 221 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE { |
| 216 } | 222 } |
| 217 | 223 |
| 218 virtual bool HasHitTestMask() const OVERRIDE { | 224 virtual bool HasHitTestMask() const OVERRIDE { |
| 219 return false; | 225 return false; |
| 220 } | 226 } |
| 221 | 227 |
| 222 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { | 228 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { |
| 223 } | 229 } |
| 224 | 230 |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 void WebContentsViewAura::RestoreFocus() { | 1192 void WebContentsViewAura::RestoreFocus() { |
| 1187 if (delegate_.get()) | 1193 if (delegate_.get()) |
| 1188 delegate_->RestoreFocus(); | 1194 delegate_->RestoreFocus(); |
| 1189 } | 1195 } |
| 1190 | 1196 |
| 1191 WebDropData* WebContentsViewAura::GetDropData() const { | 1197 WebDropData* WebContentsViewAura::GetDropData() const { |
| 1192 return current_drop_data_.get(); | 1198 return current_drop_data_.get(); |
| 1193 } | 1199 } |
| 1194 | 1200 |
| 1195 gfx::Rect WebContentsViewAura::GetViewBounds() const { | 1201 gfx::Rect WebContentsViewAura::GetViewBounds() const { |
| 1196 return window_->GetBoundsInScreen(); | 1202 return window_->GetBoundsInScreen(); |
|
scottmg
2013/03/14 22:51:53
(due to rebase, not this cl)
| |
| 1197 } | 1203 } |
| 1198 | 1204 |
| 1199 //////////////////////////////////////////////////////////////////////////////// | 1205 //////////////////////////////////////////////////////////////////////////////// |
| 1200 // WebContentsViewAura, WebContentsViewPort implementation: | 1206 // WebContentsViewAura, WebContentsViewPort implementation: |
| 1201 | 1207 |
| 1202 void WebContentsViewAura::CreateView( | 1208 void WebContentsViewAura::CreateView( |
| 1203 const gfx::Size& initial_size, gfx::NativeView context) { | 1209 const gfx::Size& initial_size, gfx::NativeView context) { |
| 1204 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 1210 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
| 1205 // if the bookmark bar is not shown and you create a new tab). The right | 1211 // if the bookmark bar is not shown and you create a new tab). The right |
| 1206 // value is set shortly after this, so its safe to ignore. | 1212 // value is set shortly after this, so its safe to ignore. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1473 // WebContentsViewAura, aura::WindowDelegate implementation: | 1479 // WebContentsViewAura, aura::WindowDelegate implementation: |
| 1474 | 1480 |
| 1475 gfx::Size WebContentsViewAura::GetMinimumSize() const { | 1481 gfx::Size WebContentsViewAura::GetMinimumSize() const { |
| 1476 return gfx::Size(); | 1482 return gfx::Size(); |
| 1477 } | 1483 } |
| 1478 | 1484 |
| 1479 gfx::Size WebContentsViewAura::GetMaximumSize() const { | 1485 gfx::Size WebContentsViewAura::GetMaximumSize() const { |
| 1480 return gfx::Size(); | 1486 return gfx::Size(); |
| 1481 } | 1487 } |
| 1482 | 1488 |
| 1489 void WebContentsViewAura::SetHostTransitionBounds(const gfx::Rect& bounds) { | |
| 1490 } | |
| 1491 | |
| 1483 void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 1492 void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 1484 const gfx::Rect& new_bounds) { | 1493 const gfx::Rect& new_bounds) { |
| 1485 SizeChangedCommon(new_bounds.size()); | 1494 SizeChangedCommon(new_bounds.size()); |
| 1486 if (delegate_.get()) | 1495 if (delegate_.get()) |
| 1487 delegate_->SizeChanged(new_bounds.size()); | 1496 delegate_->SizeChanged(new_bounds.size()); |
| 1488 | 1497 |
| 1489 // Constrained web dialogs, need to be kept centered over our content area. | 1498 // Constrained web dialogs, need to be kept centered over our content area. |
| 1490 for (size_t i = 0; i < window_->children().size(); i++) { | 1499 for (size_t i = 0; i < window_->children().size(); i++) { |
| 1491 if (window_->children()[i]->GetProperty( | 1500 if (window_->children()[i]->GetProperty( |
| 1492 aura::client::kConstrainedWindowKey)) { | 1501 aura::client::kConstrainedWindowKey)) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1535 // then destroying it in the WebContentsViewAura destructor can trigger other | 1544 // then destroying it in the WebContentsViewAura destructor can trigger other |
| 1536 // virtual functions to be called (e.g. OnImplicitAnimationsCompleted()). So | 1545 // virtual functions to be called (e.g. OnImplicitAnimationsCompleted()). So |
| 1537 // destroy the overscroll window here. | 1546 // destroy the overscroll window here. |
| 1538 navigation_overlay_.reset(); | 1547 navigation_overlay_.reset(); |
| 1539 overscroll_window_.reset(); | 1548 overscroll_window_.reset(); |
| 1540 } | 1549 } |
| 1541 | 1550 |
| 1542 void WebContentsViewAura::OnWindowDestroyed() { | 1551 void WebContentsViewAura::OnWindowDestroyed() { |
| 1543 } | 1552 } |
| 1544 | 1553 |
| 1554 void WebContentsViewAura::OnWindowHidingAnimationCompleted() { | |
| 1555 } | |
| 1556 | |
| 1545 void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) { | 1557 void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) { |
| 1546 if (visible) | 1558 if (visible) |
| 1547 web_contents_->WasShown(); | 1559 web_contents_->WasShown(); |
| 1548 else | 1560 else |
| 1549 web_contents_->WasHidden(); | 1561 web_contents_->WasHidden(); |
| 1550 } | 1562 } |
| 1551 | 1563 |
| 1552 bool WebContentsViewAura::HasHitTestMask() const { | 1564 bool WebContentsViewAura::HasHitTestMask() const { |
| 1553 return false; | 1565 return false; |
| 1554 } | 1566 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 event.location(), | 1664 event.location(), |
| 1653 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1665 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
| 1654 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1666 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1655 if (drag_dest_delegate_) | 1667 if (drag_dest_delegate_) |
| 1656 drag_dest_delegate_->OnDrop(); | 1668 drag_dest_delegate_->OnDrop(); |
| 1657 current_drop_data_.reset(); | 1669 current_drop_data_.reset(); |
| 1658 return current_drag_op_; | 1670 return current_drag_op_; |
| 1659 } | 1671 } |
| 1660 | 1672 |
| 1661 } // namespace content | 1673 } // namespace content |
| OLD | NEW |