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 "ui/views/controls/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 #include "ui/aura/window_delegate.h" | 11 #include "ui/aura/window_delegate.h" |
12 #include "ui/base/cursor/cursor.h" | 12 #include "ui/base/cursor/cursor.h" |
13 #include "ui/base/hit_test.h" | 13 #include "ui/base/hit_test.h" |
14 #include "ui/views/controls/native/native_view_host.h" | 14 #include "ui/views/controls/native/native_view_host.h" |
15 #include "ui/views/view_constants_aura.h" | 15 #include "ui/views/view_constants_aura.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 class NativeViewHostAura::ClippingWindowDelegate : public aura::WindowDelegate { | 20 class NativeViewHostAura::ClippingWindowDelegate : public aura::WindowDelegate { |
21 public: | 21 public: |
22 ClippingWindowDelegate() : native_view_(NULL) {} | 22 ClippingWindowDelegate() : native_view_(NULL) {} |
23 virtual ~ClippingWindowDelegate() {} | 23 virtual ~ClippingWindowDelegate() {} |
24 | 24 |
25 void set_native_view(aura::Window* native_view) { | 25 void set_native_view(aura::Window* native_view) { |
26 native_view_ = native_view; | 26 native_view_ = native_view; |
27 } | 27 } |
28 | 28 |
29 virtual gfx::Size GetMinimumSize() const OVERRIDE { return gfx::Size(); } | 29 virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } |
30 virtual gfx::Size GetMaximumSize() const OVERRIDE { return gfx::Size(); } | 30 virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); } |
31 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 31 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
32 const gfx::Rect& new_bounds) OVERRIDE {} | 32 const gfx::Rect& new_bounds) override {} |
33 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { | 33 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { |
34 return gfx::kNullCursor; | 34 return gfx::kNullCursor; |
35 } | 35 } |
36 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { | 36 virtual int GetNonClientComponent(const gfx::Point& point) const override { |
37 return HTCLIENT; | 37 return HTCLIENT; |
38 } | 38 } |
39 virtual bool ShouldDescendIntoChildForEventHandling( | 39 virtual bool ShouldDescendIntoChildForEventHandling( |
40 aura::Window* child, | 40 aura::Window* child, |
41 const gfx::Point& location) OVERRIDE { return true; } | 41 const gfx::Point& location) override { return true; } |
42 virtual bool CanFocus() OVERRIDE { | 42 virtual bool CanFocus() override { |
43 // Ask the hosted native view's delegate because directly calling | 43 // Ask the hosted native view's delegate because directly calling |
44 // aura::Window::CanFocus() will call back into this when checking whether | 44 // aura::Window::CanFocus() will call back into this when checking whether |
45 // parents can focus. | 45 // parents can focus. |
46 return native_view_ && native_view_->delegate() | 46 return native_view_ && native_view_->delegate() |
47 ? native_view_->delegate()->CanFocus() | 47 ? native_view_->delegate()->CanFocus() |
48 : true; | 48 : true; |
49 } | 49 } |
50 virtual void OnCaptureLost() OVERRIDE {} | 50 virtual void OnCaptureLost() override {} |
51 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {} | 51 virtual void OnPaint(gfx::Canvas* canvas) override {} |
52 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 52 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
53 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} | 53 virtual void OnWindowDestroying(aura::Window* window) override {} |
54 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {} | 54 virtual void OnWindowDestroyed(aura::Window* window) override {} |
55 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} | 55 virtual void OnWindowTargetVisibilityChanged(bool visible) override {} |
56 virtual bool HasHitTestMask() const OVERRIDE { return false; } | 56 virtual bool HasHitTestMask() const override { return false; } |
57 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 57 virtual void GetHitTestMask(gfx::Path* mask) const override {} |
58 | 58 |
59 private: | 59 private: |
60 aura::Window* native_view_; | 60 aura::Window* native_view_; |
61 }; | 61 }; |
62 | 62 |
63 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) | 63 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
64 : host_(host), | 64 : host_(host), |
65 clipping_window_delegate_(new ClippingWindowDelegate()), | 65 clipping_window_delegate_(new ClippingWindowDelegate()), |
66 clipping_window_(clipping_window_delegate_.get()) { | 66 clipping_window_(clipping_window_delegate_.get()) { |
67 // Set the type so descendant views (including popups) get positioned | 67 // Set the type so descendant views (including popups) get positioned |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } else { | 226 } else { |
227 clipping_window_.RemoveChild(host_->native_view()); | 227 clipping_window_.RemoveChild(host_->native_view()); |
228 } | 228 } |
229 host_->native_view()->SetBounds(clipping_window_.bounds()); | 229 host_->native_view()->SetBounds(clipping_window_.bounds()); |
230 } | 230 } |
231 if (clipping_window_.parent()) | 231 if (clipping_window_.parent()) |
232 clipping_window_.parent()->RemoveChild(&clipping_window_); | 232 clipping_window_.parent()->RemoveChild(&clipping_window_); |
233 } | 233 } |
234 | 234 |
235 } // namespace views | 235 } // namespace views |
OLD | NEW |