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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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/window/native_frame_view.h ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/window/native_frame_view.h"
6
7 #include "ui/views/widget/native_widget.h"
8 #include "ui/views/widget/widget.h"
9
10 #if defined(OS_WIN)
11 #include "ui/views/win/hwnd_util.h"
12 #endif
13
14 namespace views {
15
16 ////////////////////////////////////////////////////////////////////////////////
17 // NativeFrameView, public:
18
19 // static
20 const char NativeFrameView::kViewClassName[] = "NativeFrameView";
21
22 NativeFrameView::NativeFrameView(Widget* frame)
23 : NonClientFrameView(),
24 frame_(frame) {
25 }
26
27 NativeFrameView::~NativeFrameView() {
28 }
29
30 ////////////////////////////////////////////////////////////////////////////////
31 // NativeFrameView, NonClientFrameView overrides:
32
33 gfx::Rect NativeFrameView::GetBoundsForClientView() const {
34 return gfx::Rect(0, 0, width(), height());
35 }
36
37 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds(
38 const gfx::Rect& client_bounds) const {
39 #if defined(OS_WIN)
40 return views::GetWindowBoundsForClientBounds(
41 static_cast<View*>(const_cast<NativeFrameView*>(this)), client_bounds);
42 #else
43 // Enforce minimum size (1, 1) in case that |client_bounds| is passed with
44 // empty size.
45 gfx::Rect window_bounds = client_bounds;
46 if (window_bounds.IsEmpty())
47 window_bounds.set_size(gfx::Size(1,1));
48 return window_bounds;
49 #endif
50 }
51
52 int NativeFrameView::NonClientHitTest(const gfx::Point& point) {
53 return frame_->client_view()->NonClientHitTest(point);
54 }
55
56 void NativeFrameView::GetWindowMask(const gfx::Size& size,
57 gfx::Path* window_mask) {
58 // Nothing to do, we use the default window mask.
59 }
60
61 void NativeFrameView::ResetWindowControls() {
62 // Nothing to do.
63 }
64
65 void NativeFrameView::UpdateWindowIcon() {
66 // Nothing to do.
67 }
68
69 void NativeFrameView::UpdateWindowTitle() {
70 // Nothing to do.
71 }
72
73 void NativeFrameView::SizeConstraintsChanged() {
74 // Nothing to do.
75 }
76
77 gfx::Size NativeFrameView::GetPreferredSize() const {
78 gfx::Size client_preferred_size = frame_->client_view()->GetPreferredSize();
79 #if defined(OS_WIN)
80 // Returns the client size. On Windows, this is the expected behavior for
81 // native frames (see |NativeWidgetWin::WidgetSizeIsClientSize()|), while
82 // other platforms currently always return client bounds from
83 // |GetWindowBoundsForClientBounds()|.
84 return client_preferred_size;
85 #else
86 return frame_->non_client_view()->GetWindowBoundsForClientBounds(
87 gfx::Rect(client_preferred_size)).size();
88 #endif
89 }
90
91 gfx::Size NativeFrameView::GetMinimumSize() const {
92 return frame_->client_view()->GetMinimumSize();
93 }
94
95 gfx::Size NativeFrameView::GetMaximumSize() const {
96 return frame_->client_view()->GetMaximumSize();
97 }
98
99 const char* NativeFrameView::GetClassName() const {
100 return kViewClassName;
101 }
102
103 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/native_frame_view.h ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698