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

Side by Side Diff: ui/views/window/native_frame_view.cc

Issue 13896011: Make javascript dialogs into top-level windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct window bounds calculations for native dialogs on desktop windows aura. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/window/native_frame_view.h" 5 #include "ui/views/window/native_frame_view.h"
6 6
7 #include "ui/views/widget/native_widget.h" 7 #include "ui/views/widget/native_widget.h"
8 #include "ui/views/widget/widget.h" 8 #include "ui/views/widget/widget.h"
9 9
10 #if defined(USE_AURA) && defined(OS_WIN)
11 #include "ui/aura/root_window.h"
12 #endif
13
10 namespace views { 14 namespace views {
11 15
12 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
13 // NativeFrameView, public: 17 // NativeFrameView, public:
14 18
15 NativeFrameView::NativeFrameView(Widget* frame) 19 NativeFrameView::NativeFrameView(Widget* frame)
16 : NonClientFrameView(), 20 : NonClientFrameView(),
17 frame_(frame) { 21 frame_(frame) {
18 } 22 }
19 23
20 NativeFrameView::~NativeFrameView() { 24 NativeFrameView::~NativeFrameView() {
21 } 25 }
22 26
23 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
24 // NativeFrameView, NonClientFrameView overrides: 28 // NativeFrameView, NonClientFrameView overrides:
25 29
26 gfx::Rect NativeFrameView::GetBoundsForClientView() const { 30 gfx::Rect NativeFrameView::GetBoundsForClientView() const {
27 return gfx::Rect(0, 0, width(), height()); 31 return gfx::Rect(0, 0, width(), height());
28 } 32 }
29 33
30 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( 34 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds(
31 const gfx::Rect& client_bounds) const { 35 const gfx::Rect& client_bounds) const {
32 #if defined(OS_WIN) && !defined(USE_AURA) 36 #if defined(OS_WIN)
37 #if defined(USE_AURA)
38 aura::RootWindow* window = GetWidget()->GetNativeWindow()->GetRootWindow();
39 if (window) {
40 gfx::AcceleratedWidget hwnd = window->GetAcceleratedWidget();
Ben Goodger (Google) 2013/04/29 16:21:55 do we have a util file in views/ui that has a bunc
robertshield 2013/04/29 21:49:59 Moved most of this into hwnd_util_[win|aurawin].cc
41 RECT rect = client_bounds.ToRECT();
42 DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
43 DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
44 AdjustWindowRectEx(&rect, style, FALSE, ex_style);
45 return gfx::Rect(rect);
46 } else {
47 return client_bounds;
48 }
49 #else
33 RECT rect = client_bounds.ToRECT(); 50 RECT rect = client_bounds.ToRECT();
34 DWORD style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_STYLE); 51 DWORD style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_STYLE);
35 DWORD ex_style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_EXSTYLE); 52 DWORD ex_style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_EXSTYLE);
36 AdjustWindowRectEx(&rect, style, FALSE, ex_style); 53 AdjustWindowRectEx(&rect, style, FALSE, ex_style);
37 return gfx::Rect(rect); 54 return gfx::Rect(rect);
55 #endif // defined(USE_AURA)
38 #else 56 #else
39 // TODO(sad): 57 // TODO(sad):
40 return client_bounds; 58 return client_bounds;
41 #endif 59 #endif
42 } 60 }
43 61
44 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { 62 int NativeFrameView::NonClientHitTest(const gfx::Point& point) {
45 return frame_->client_view()->NonClientHitTest(point); 63 return frame_->client_view()->NonClientHitTest(point);
46 } 64 }
47 65
(...skipping 12 matching lines...) Expand all
60 78
61 void NativeFrameView::UpdateWindowTitle() { 79 void NativeFrameView::UpdateWindowTitle() {
62 // Nothing to do. 80 // Nothing to do.
63 } 81 }
64 82
65 gfx::Size NativeFrameView::GetPreferredSize() { 83 gfx::Size NativeFrameView::GetPreferredSize() {
66 return frame_->client_view()->GetPreferredSize(); 84 return frame_->client_view()->GetPreferredSize();
67 } 85 }
68 86
69 } // namespace views 87 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698