| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/window/non_client_view.h" | 5 #include "views/window/non_client_view.h" |
| 6 | 6 |
| 7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
| 8 #include "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // z-order first and we always want the client view to have first crack at | 25 // z-order first and we always want the client view to have first crack at |
| 26 // handling mouse messages. | 26 // handling mouse messages. |
| 27 static const int kFrameViewIndex = 0; | 27 static const int kFrameViewIndex = 0; |
| 28 static const int kClientViewIndex = 1; | 28 static const int kClientViewIndex = 1; |
| 29 | 29 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 31 // NonClientView, public: | 31 // NonClientView, public: |
| 32 | 32 |
| 33 NonClientView::NonClientView(Window* frame) | 33 NonClientView::NonClientView(Window* frame) |
| 34 : frame_(frame), | 34 : frame_(frame), |
| 35 client_view_(NULL) { | 35 client_view_(NULL), |
| 36 force_aero_glass_frame_(false) { |
| 36 } | 37 } |
| 37 | 38 |
| 38 NonClientView::~NonClientView() { | 39 NonClientView::~NonClientView() { |
| 39 // This value may have been reset before the window hierarchy shuts down, | 40 // This value may have been reset before the window hierarchy shuts down, |
| 40 // so we need to manually remove it. | 41 // so we need to manually remove it. |
| 41 RemoveChildView(frame_view_.get()); | 42 RemoveChildView(frame_view_.get()); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void NonClientView::SetFrameView(NonClientFrameView* frame_view) { | 45 void NonClientView::SetFrameView(NonClientFrameView* frame_view) { |
| 45 // See comment in header about ownership. | 46 // See comment in header about ownership. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 | 62 |
| 62 void NonClientView::UpdateFrame() { | 63 void NonClientView::UpdateFrame() { |
| 63 SetFrameView(frame_->CreateFrameViewForWindow()); | 64 SetFrameView(frame_->CreateFrameViewForWindow()); |
| 64 GetRootView()->ThemeChanged(); | 65 GetRootView()->ThemeChanged(); |
| 65 Layout(); | 66 Layout(); |
| 66 SchedulePaint(); | 67 SchedulePaint(); |
| 67 frame_->UpdateFrameAfterFrameChange(); | 68 frame_->UpdateFrameAfterFrameChange(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 bool NonClientView::UseNativeFrame() const { | 71 bool NonClientView::UseNativeFrame() const { |
| 72 if (force_aero_glass_frame_) |
| 73 return true; |
| 71 // The frame view may always require a custom frame, e.g. Constrained Windows. | 74 // The frame view may always require a custom frame, e.g. Constrained Windows. |
| 72 if (frame_view_.get() && frame_view_->AlwaysUseCustomFrame()) | 75 if (frame_view_.get() && frame_view_->AlwaysUseCustomFrame()) |
| 73 return false; | 76 return false; |
| 74 return frame_->ShouldUseNativeFrame(); | 77 return frame_->ShouldUseNativeFrame(); |
| 75 } | 78 } |
| 76 | 79 |
| 77 void NonClientView::DisableInactiveRendering(bool disable) { | 80 void NonClientView::DisableInactiveRendering(bool disable) { |
| 78 frame_view_->DisableInactiveRendering(disable); | 81 frame_view_->DisableInactiveRendering(disable); |
| 79 } | 82 } |
| 80 | 83 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // The assumption is that the frame view's implementation of HitTest will only | 180 // The assumption is that the frame view's implementation of HitTest will only |
| 178 // return true for area not occupied by the client view. | 181 // return true for area not occupied by the client view. |
| 179 gfx::Point point_in_child_coords(point); | 182 gfx::Point point_in_child_coords(point); |
| 180 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 183 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
| 181 if (frame_view_->HitTest(point_in_child_coords)) | 184 if (frame_view_->HitTest(point_in_child_coords)) |
| 182 return frame_view_->GetViewForPoint(point); | 185 return frame_view_->GetViewForPoint(point); |
| 183 | 186 |
| 184 return View::GetViewForPoint(point); | 187 return View::GetViewForPoint(point); |
| 185 } | 188 } |
| 186 | 189 |
| 190 void NonClientView::ForceAeroGlassFrame() { |
| 191 force_aero_glass_frame_ = true; |
| 192 } |
| 193 |
| 187 //////////////////////////////////////////////////////////////////////////////// | 194 //////////////////////////////////////////////////////////////////////////////// |
| 188 // NonClientFrameView, View overrides: | 195 // NonClientFrameView, View overrides: |
| 189 | 196 |
| 190 bool NonClientFrameView::HitTest(const gfx::Point& l) const { | 197 bool NonClientFrameView::HitTest(const gfx::Point& l) const { |
| 191 // For the default case, we assume the non-client frame view never overlaps | 198 // For the default case, we assume the non-client frame view never overlaps |
| 192 // the client view. | 199 // the client view. |
| 193 return !GetWindow()->GetClientView()->bounds().Contains(l); | 200 return !GetWindow()->GetClientView()->bounds().Contains(l); |
| 194 } | 201 } |
| 195 | 202 |
| 196 void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous, | 203 void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } else { | 252 } else { |
| 246 return HTNOWHERE; | 253 return HTNOWHERE; |
| 247 } | 254 } |
| 248 | 255 |
| 249 // If the window can't be resized, there are no resize boundaries, just | 256 // If the window can't be resized, there are no resize boundaries, just |
| 250 // window borders. | 257 // window borders. |
| 251 return can_resize ? component : HTBORDER; | 258 return can_resize ? component : HTBORDER; |
| 252 } | 259 } |
| 253 | 260 |
| 254 } // namespace views | 261 } // namespace views |
| OLD | NEW |