• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
NativeFrameView(Widget * frame)19 NativeFrameView::NativeFrameView(Widget* frame)
20     : NonClientFrameView(),
21       frame_(frame) {
22 }
23 
~NativeFrameView()24 NativeFrameView::~NativeFrameView() {
25 }
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 // NativeFrameView, NonClientFrameView overrides:
29 
GetBoundsForClientView() const30 gfx::Rect NativeFrameView::GetBoundsForClientView() const {
31   return gfx::Rect(0, 0, width(), height());
32 }
33 
GetWindowBoundsForClientBounds(const gfx::Rect & client_bounds) const34 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds(
35     const gfx::Rect& client_bounds) const {
36 #if defined(OS_WIN)
37   return views::GetWindowBoundsForClientBounds(
38       static_cast<View*>(const_cast<NativeFrameView*>(this)), client_bounds);
39 #else
40   // TODO(sad):
41   return client_bounds;
42 #endif
43 }
44 
NonClientHitTest(const gfx::Point & point)45 int NativeFrameView::NonClientHitTest(const gfx::Point& point) {
46   return frame_->client_view()->NonClientHitTest(point);
47 }
48 
GetWindowMask(const gfx::Size & size,gfx::Path * window_mask)49 void NativeFrameView::GetWindowMask(const gfx::Size& size,
50                                     gfx::Path* window_mask) {
51   // Nothing to do, we use the default window mask.
52 }
53 
ResetWindowControls()54 void NativeFrameView::ResetWindowControls() {
55   // Nothing to do.
56 }
57 
UpdateWindowIcon()58 void NativeFrameView::UpdateWindowIcon() {
59   // Nothing to do.
60 }
61 
UpdateWindowTitle()62 void NativeFrameView::UpdateWindowTitle() {
63   // Nothing to do.
64 }
65 
66 // Returns the client size. On Windows, this is the expected behavior for
67 // native frames (see |NativeWidgetWin::WidgetSizeIsClientSize()|), while other
68 // platforms currently always return client bounds from
69 // |GetWindowBoundsForClientBounds()|.
GetPreferredSize()70 gfx::Size NativeFrameView::GetPreferredSize() {
71   return frame_->client_view()->GetPreferredSize();
72 }
73 
GetMinimumSize()74 gfx::Size NativeFrameView::GetMinimumSize() {
75   return frame_->client_view()->GetMinimumSize();
76 }
77 
GetMaximumSize()78 gfx::Size NativeFrameView::GetMaximumSize() {
79   return frame_->client_view()->GetMaximumSize();
80 }
81 
82 }  // namespace views
83