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 |
kevers
2013/04/19 20:31:42
CRLF issue?
| |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/native/native_view_host.h" | 5 #include "ui/views/controls/native/native_view_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/win/dpi.h" | |
8 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
9 #include "ui/views/controls/native/native_view_host_wrapper.h" | 10 #include "ui/views/controls/native/native_view_host_wrapper.h" |
10 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 | 14 |
14 // static | 15 // static |
15 const char NativeViewHost::kViewClassName[] = "views/NativeViewHost"; | 16 const char NativeViewHost::kViewClassName[] = "views/NativeViewHost"; |
16 | 17 |
17 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
96 if (visible) { | 97 if (visible) { |
97 // Since widgets know nothing about the View hierarchy (they are direct | 98 // Since widgets know nothing about the View hierarchy (they are direct |
98 // children of the Widget that hosts our View hierarchy) they need to be | 99 // children of the Widget that hosts our View hierarchy) they need to be |
99 // positioned in the coordinate system of the Widget, not the current | 100 // positioned in the coordinate system of the Widget, not the current |
100 // view. Also, they should be positioned respecting the border insets | 101 // view. Also, they should be positioned respecting the border insets |
101 // of the native view. | 102 // of the native view. |
102 gfx::Rect local_bounds = ConvertRectToWidget(GetContentsBounds()); | 103 gfx::Rect local_bounds = ConvertRectToWidget(GetContentsBounds()); |
103 native_wrapper_->ShowWidget(local_bounds.x(), local_bounds.y(), | 104 gfx::Rect mapped_bounds = ui::win::DIPToScreenRect(local_bounds); |
104 local_bounds.width(), | 105 native_wrapper_->ShowWidget(mapped_bounds.x(), mapped_bounds.y(), |
105 local_bounds.height()); | 106 mapped_bounds.width(), |
107 mapped_bounds.height()); | |
106 } else { | 108 } else { |
107 native_wrapper_->HideWidget(); | 109 native_wrapper_->HideWidget(); |
108 } | 110 } |
109 fast_resize_at_last_layout_ = visible && fast_resize_; | 111 fast_resize_at_last_layout_ = visible && fast_resize_; |
110 } | 112 } |
111 | 113 |
112 void NativeViewHost::OnPaint(gfx::Canvas* canvas) { | 114 void NativeViewHost::OnPaint(gfx::Canvas* canvas) { |
113 // Paint background if there is one. NativeViewHost needs to paint | 115 // Paint background if there is one. NativeViewHost needs to paint |
114 // a background when it is hosted in a TabbedPane. For Gtk implementation, | 116 // a background when it is hosted in a TabbedPane. For Gtk implementation, |
115 // NativeTabbedPaneGtk uses a NativeWidgetGtk as page container and because | 117 // NativeTabbedPaneGtk uses a NativeWidgetGtk as page container and because |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 Widget::GetAllChildWidgets(native_view(), &widgets); | 200 Widget::GetAllChildWidgets(native_view(), &widgets); |
199 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { | 201 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { |
200 focus_manager->ViewRemoved((*i)->GetRootView()); | 202 focus_manager->ViewRemoved((*i)->GetRootView()); |
201 if (!focus_manager->GetFocusedView()) | 203 if (!focus_manager->GetFocusedView()) |
202 return; | 204 return; |
203 } | 205 } |
204 } | 206 } |
205 | 207 |
206 | 208 |
207 } // namespace views | 209 } // namespace views |
OLD | NEW |