| OLD | NEW | 
|    1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2010 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 "views/widget/root_view.h" |    7 #include "views/widget/root_view.h" | 
|    8 #include "views/widget/widget.h" |    8 #include "views/widget/widget.h" | 
|    9 #include "views/window/window.h" |    9 #include "views/window/window.h" | 
|   10  |   10  | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   37   // so we need to manually remove it. |   37   // so we need to manually remove it. | 
|   38   RemoveChildView(frame_view_.get()); |   38   RemoveChildView(frame_view_.get()); | 
|   39 } |   39 } | 
|   40  |   40  | 
|   41 void NonClientView::SetFrameView(NonClientFrameView* frame_view) { |   41 void NonClientView::SetFrameView(NonClientFrameView* frame_view) { | 
|   42   // See comment in header about ownership. |   42   // See comment in header about ownership. | 
|   43   frame_view->set_parent_owned(false); |   43   frame_view->set_parent_owned(false); | 
|   44   if (frame_view_.get()) |   44   if (frame_view_.get()) | 
|   45     RemoveChildView(frame_view_.get()); |   45     RemoveChildView(frame_view_.get()); | 
|   46   frame_view_.reset(frame_view); |   46   frame_view_.reset(frame_view); | 
|   47   if (GetParent()) |   47   if (parent()) | 
|   48     AddChildView(kFrameViewIndex, frame_view_.get()); |   48     AddChildViewAt(frame_view_.get(), kFrameViewIndex); | 
|   49 } |   49 } | 
|   50  |   50  | 
|   51 bool NonClientView::CanClose() const { |   51 bool NonClientView::CanClose() const { | 
|   52   return client_view_->CanClose(); |   52   return client_view_->CanClose(); | 
|   53 } |   53 } | 
|   54  |   54  | 
|   55 void NonClientView::WindowClosing() { |   55 void NonClientView::WindowClosing() { | 
|   56   client_view_->WindowClosing(); |   56   client_view_->WindowClosing(); | 
|   57 } |   57 } | 
|   58  |   58  | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  146   // reason as above. |  146   // reason as above. | 
|  147   client_view_->Layout(); |  147   client_view_->Layout(); | 
|  148 } |  148 } | 
|  149  |  149  | 
|  150 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, |  150 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, | 
|  151                                          View* child) { |  151                                          View* child) { | 
|  152   // Add our two child views here as we are added to the Widget so that if we |  152   // Add our two child views here as we are added to the Widget so that if we | 
|  153   // are subsequently resized all the parent-child relationships are |  153   // are subsequently resized all the parent-child relationships are | 
|  154   // established. |  154   // established. | 
|  155   if (is_add && GetWidget() && child == this) { |  155   if (is_add && GetWidget() && child == this) { | 
|  156     AddChildView(kFrameViewIndex, frame_view_.get()); |  156     AddChildViewAt(frame_view_.get(), kFrameViewIndex); | 
|  157     AddChildView(kClientViewIndex, client_view_); |  157     AddChildViewAt(client_view_, kClientViewIndex); | 
|  158   } |  158   } | 
|  159 } |  159 } | 
|  160  |  160  | 
|  161 views::View* NonClientView::GetViewForPoint(const gfx::Point& point) { |  161 views::View* NonClientView::GetViewForPoint(const gfx::Point& point) { | 
|  162   // Because of the z-ordering of our child views (the client view is positioned |  162   // Because of the z-ordering of our child views (the client view is positioned | 
|  163   // over the non-client frame view, if the client view ever overlaps the frame |  163   // over the non-client frame view, if the client view ever overlaps the frame | 
|  164   // view visually (as it does for the browser window), then it will eat mouse |  164   // view visually (as it does for the browser window), then it will eat mouse | 
|  165   // events for the window controls. We override this method here so that we can |  165   // events for the window controls. We override this method here so that we can | 
|  166   // detect this condition and re-route the events to the non-client frame view. |  166   // detect this condition and re-route the events to the non-client frame view. | 
|  167   // The assumption is that the frame view's implementation of HitTest will only |  167   // The assumption is that the frame view's implementation of HitTest will only | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  246  |  246  | 
|  247 bool NonClientFrameView::ShouldPaintAsActive() const { |  247 bool NonClientFrameView::ShouldPaintAsActive() const { | 
|  248   return GetWindow()->IsActive() || paint_as_active_; |  248   return GetWindow()->IsActive() || paint_as_active_; | 
|  249 } |  249 } | 
|  250  |  250  | 
|  251 AccessibilityTypes::Role NonClientFrameView::GetAccessibleRole() { |  251 AccessibilityTypes::Role NonClientFrameView::GetAccessibleRole() { | 
|  252   return AccessibilityTypes::ROLE_WINDOW; |  252   return AccessibilityTypes::ROLE_WINDOW; | 
|  253 } |  253 } | 
|  254  |  254  | 
|  255 }  // namespace views |  255 }  // namespace views | 
| OLD | NEW |