| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "views/controls/native/native_view_host.h" | 5 #include "views/controls/native/native_view_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
| 9 #include "views/controls/native/native_view_host_wrapper.h" | 9 #include "views/controls/native/native_view_host_wrapper.h" |
| 10 #include "views/controls/native/native_view_host_views.h" | 10 #include "views/controls/native/native_view_host_views.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 if (visible) { | 115 if (visible) { |
| 116 // Since widgets know nothing about the View hierarchy (they are direct | 116 // Since widgets know nothing about the View hierarchy (they are direct |
| 117 // children of the Widget that hosts our View hierarchy) they need to be | 117 // children of the Widget that hosts our View hierarchy) they need to be |
| 118 // positioned in the coordinate system of the Widget, not the current | 118 // positioned in the coordinate system of the Widget, not the current |
| 119 // view. Also, they should be positioned respecting the border insets | 119 // view. Also, they should be positioned respecting the border insets |
| 120 // of the native view. | 120 // of the native view. |
| 121 gfx::Insets insets = GetInsets(); | 121 gfx::Insets insets = GetInsets(); |
| 122 gfx::Point top_left(insets.left(), insets.top()); | 122 gfx::Point top_left(insets.left(), insets.top()); |
| 123 ConvertPointToWidget(this, &top_left); | 123 ConvertPointToWidget(this, &top_left); |
| 124 gfx::Rect local_bounds = GetLocalBounds(); | 124 gfx::Rect local_bounds = GetContentsBounds(); |
| 125 native_wrapper_->ShowWidget(top_left.x(), top_left.y(), | 125 native_wrapper_->ShowWidget(top_left.x(), top_left.y(), |
| 126 local_bounds.width(), | 126 local_bounds.width(), |
| 127 local_bounds.height()); | 127 local_bounds.height()); |
| 128 } else { | 128 } else { |
| 129 native_wrapper_->HideWidget(); | 129 native_wrapper_->HideWidget(); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 void NativeViewHost::Paint(gfx::Canvas* canvas) { | 133 void NativeViewHost::Paint(gfx::Canvas* canvas) { |
| 134 // Paint background if there is one. NativeViewHost needs to paint | 134 // Paint background if there is one. NativeViewHost needs to paint |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // NativeViewHost, private: | 199 // NativeViewHost, private: |
| 200 | 200 |
| 201 void NativeViewHost::Detach(bool destroyed) { | 201 void NativeViewHost::Detach(bool destroyed) { |
| 202 DCHECK(native_view_ || views_view_); | 202 DCHECK(native_view_ || views_view_); |
| 203 native_wrapper_->NativeViewDetaching(destroyed); | 203 native_wrapper_->NativeViewDetaching(destroyed); |
| 204 native_view_ = NULL; | 204 native_view_ = NULL; |
| 205 views_view_ = NULL; | 205 views_view_ = NULL; |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace views | 208 } // namespace views |
| OLD | NEW |