Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1190)

Side by Side Diff: ui/views/controls/native/native_view_host.cc

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/drag_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 native_wrapper_->UninstallClip(); 93 native_wrapper_->UninstallClip();
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 contents_bounds = GetContentsBounds();
104 #if defined(ENABLE_HIDPI)
105 // TODO: This code probably needs to be copied into the fast_resize handler, above.
106 static float dpi_scale = ui::GetDPIScale();
107 contents_bounds.SetRect(dpi_scale * contents_bounds.x(),
108 dpi_scale * contents_bounds.y(), dpi_scale * contents_bounds.width(),
109 dpi_scale * contents_bounds.height());
110 #endif
111 gfx::Rect local_bounds = ConvertRectToWidget(contents_bounds);
103 native_wrapper_->ShowWidget(local_bounds.x(), local_bounds.y(), 112 native_wrapper_->ShowWidget(local_bounds.x(), local_bounds.y(),
104 local_bounds.width(), 113 local_bounds.width(),
105 local_bounds.height()); 114 local_bounds.height());
106 } else { 115 } else {
107 native_wrapper_->HideWidget(); 116 native_wrapper_->HideWidget();
108 } 117 }
109 fast_resize_at_last_layout_ = visible && fast_resize_; 118 fast_resize_at_last_layout_ = visible && fast_resize_;
110 } 119 }
111 120
112 void NativeViewHost::OnPaint(gfx::Canvas* canvas) { 121 void NativeViewHost::OnPaint(gfx::Canvas* canvas) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 Widget::GetAllChildWidgets(native_view(), &widgets); 208 Widget::GetAllChildWidgets(native_view(), &widgets);
200 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { 209 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) {
201 focus_manager->ViewRemoved((*i)->GetRootView()); 210 focus_manager->ViewRemoved((*i)->GetRootView());
202 if (!focus_manager->GetFocusedView()) 211 if (!focus_manager->GetFocusedView())
203 return; 212 return;
204 } 213 }
205 } 214 }
206 215
207 216
208 } // namespace views 217 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698