OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/services/native_viewport/native_viewport.h" | 5 #include "mojo/services/native_viewport/native_viewport.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/gfx/win/msg_util.h" | 8 #include "ui/gfx/win/msg_util.h" |
9 #include "ui/gfx/win/window_impl.h" | 9 #include "ui/gfx/win/window_impl.h" |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 HBRUSH red_brush = CreateSolidBrush(RGB(255, 0, 0)); | 136 HBRUSH red_brush = CreateSolidBrush(RGB(255, 0, 0)); |
137 HGDIOBJ old_object = SelectObject(dc, red_brush); | 137 HGDIOBJ old_object = SelectObject(dc, red_brush); |
138 Rectangle(dc, cr.left, cr.top, cr.right, cr.bottom); | 138 Rectangle(dc, cr.left, cr.top, cr.right, cr.bottom); |
139 SelectObject(dc, old_object); | 139 SelectObject(dc, old_object); |
140 DeleteObject(red_brush); | 140 DeleteObject(red_brush); |
141 EndPaint(hwnd(), &ps); | 141 EndPaint(hwnd(), &ps); |
142 } | 142 } |
143 void OnWindowPosChanged(WINDOWPOS* window_pos) { | 143 void OnWindowPosChanged(WINDOWPOS* window_pos) { |
144 if (!(window_pos->flags & SWP_NOSIZE) || | 144 if (!(window_pos->flags & SWP_NOSIZE) || |
145 !(window_pos->flags & SWP_NOMOVE)) { | 145 !(window_pos->flags & SWP_NOMOVE)) { |
146 delegate_->OnBoundsChanged(gfx::Rect(window_pos->x, window_pos->y, | 146 RECT cr; |
147 window_pos->cx, window_pos->cy)); | 147 GetClientRect(hwnd(), &cr); |
| 148 delegate_->OnBoundsChanged( |
| 149 gfx::Rect(window_pos->x, window_pos->y, |
| 150 cr.right - cr.left, cr.bottom - cr.top)); |
148 } | 151 } |
149 } | 152 } |
150 | 153 |
151 NativeViewportDelegate* delegate_; | 154 NativeViewportDelegate* delegate_; |
152 | 155 |
153 DISALLOW_COPY_AND_ASSIGN(NativeViewportWin); | 156 DISALLOW_COPY_AND_ASSIGN(NativeViewportWin); |
154 }; | 157 }; |
155 | 158 |
156 // static | 159 // static |
157 scoped_ptr<NativeViewport> NativeViewport::Create( | 160 scoped_ptr<NativeViewport> NativeViewport::Create( |
158 shell::Context* context, | 161 shell::Context* context, |
159 NativeViewportDelegate* delegate) { | 162 NativeViewportDelegate* delegate) { |
160 return scoped_ptr<NativeViewport>(new NativeViewportWin(delegate)).Pass(); | 163 return scoped_ptr<NativeViewport>(new NativeViewportWin(delegate)).Pass(); |
161 } | 164 } |
162 | 165 |
163 } // namespace services | 166 } // namespace services |
164 } // namespace mojo | 167 } // namespace mojo |
OLD | NEW |