| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 *name = accessible_name_; | 197 *name = accessible_name_; |
| 195 return true; | 198 return true; |
| 196 } | 199 } |
| 197 return false; | 200 return false; |
| 198 } | 201 } |
| 199 | 202 |
| 200 void NonClientView::SetAccessibleName(const std::wstring& name) { | 203 void NonClientView::SetAccessibleName(const std::wstring& name) { |
| 201 accessible_name_ = name; | 204 accessible_name_ = name; |
| 202 } | 205 } |
| 203 | 206 |
| 207 void NonClientView::ForceAeroGlassFrame() { |
| 208 force_aero_glass_frame_ = true; |
| 209 } |
| 210 |
| 204 //////////////////////////////////////////////////////////////////////////////// | 211 //////////////////////////////////////////////////////////////////////////////// |
| 205 // NonClientFrameView, View overrides: | 212 // NonClientFrameView, View overrides: |
| 206 | 213 |
| 207 bool NonClientFrameView::HitTest(const gfx::Point& l) const { | 214 bool NonClientFrameView::HitTest(const gfx::Point& l) const { |
| 208 // For the default case, we assume the non-client frame view never overlaps | 215 // For the default case, we assume the non-client frame view never overlaps |
| 209 // the client view. | 216 // the client view. |
| 210 return !GetWindow()->GetClientView()->bounds().Contains(l); | 217 return !GetWindow()->GetClientView()->bounds().Contains(l); |
| 211 } | 218 } |
| 212 | 219 |
| 213 void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous, | 220 void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } else { | 269 } else { |
| 263 return HTNOWHERE; | 270 return HTNOWHERE; |
| 264 } | 271 } |
| 265 | 272 |
| 266 // If the window can't be resized, there are no resize boundaries, just | 273 // If the window can't be resized, there are no resize boundaries, just |
| 267 // window borders. | 274 // window borders. |
| 268 return can_resize ? component : HTBORDER; | 275 return can_resize ? component : HTBORDER; |
| 269 } | 276 } |
| 270 | 277 |
| 271 } // namespace views | 278 } // namespace views |
| OLD | NEW |