| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/widget/native_widget_views.h" | 5 #include "views/widget/native_widget_views.h" |
| 6 | 6 |
| 7 #include "ui/gfx/compositor/compositor.h" | 7 #include "ui/gfx/compositor/compositor.h" |
| 8 #include "views/desktop/desktop_window_view.h" | 8 #include "views/desktop/desktop_window_view.h" |
| 9 #include "views/view.h" | 9 #include "views/view.h" |
| 10 #include "views/views_delegate.h" | 10 #include "views/views_delegate.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 Widget* NativeWidgetViews::GetWidget() { | 165 Widget* NativeWidgetViews::GetWidget() { |
| 166 return delegate_->AsWidget(); | 166 return delegate_->AsWidget(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 const Widget* NativeWidgetViews::GetWidget() const { | 169 const Widget* NativeWidgetViews::GetWidget() const { |
| 170 return delegate_->AsWidget(); | 170 return delegate_->AsWidget(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 gfx::NativeView NativeWidgetViews::GetNativeView() const { | 173 gfx::NativeView NativeWidgetViews::GetNativeView() const { |
| 174 return GetParentNativeWidget()->GetNativeView(); | 174 return GetParentNativeWidget() ? |
| 175 GetParentNativeWidget()->GetNativeView() : NULL; |
| 175 } | 176 } |
| 176 | 177 |
| 177 gfx::NativeWindow NativeWidgetViews::GetNativeWindow() const { | 178 gfx::NativeWindow NativeWidgetViews::GetNativeWindow() const { |
| 178 return GetParentNativeWidget()->GetNativeWindow(); | 179 return GetParentNativeWidget() ? |
| 180 GetParentNativeWidget()->GetNativeWindow() : NULL; |
| 179 } | 181 } |
| 180 | 182 |
| 181 Widget* NativeWidgetViews::GetTopLevelWidget() { | 183 Widget* NativeWidgetViews::GetTopLevelWidget() { |
| 182 // This can get called when this is in the process of being destroyed, and | 184 // This can get called when this is in the process of being destroyed, and |
| 183 // view_ has already been unset. | 185 // view_ has already been unset. |
| 184 if (!view_) | 186 if (!view_) |
| 185 return GetWidget(); | 187 return GetWidget(); |
| 186 if (ViewsDelegate::views_delegate && | 188 if (ViewsDelegate::views_delegate && |
| 187 view_->parent() == ViewsDelegate::views_delegate->GetDefaultParentView()) | 189 view_->parent() == ViewsDelegate::views_delegate->GetDefaultParentView()) |
| 188 return GetWidget(); | 190 return GetWidget(); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 581 } |
| 580 default: | 582 default: |
| 581 // Everything else falls into standard client event handling. | 583 // Everything else falls into standard client event handling. |
| 582 break; | 584 break; |
| 583 } | 585 } |
| 584 } | 586 } |
| 585 return false; | 587 return false; |
| 586 } | 588 } |
| 587 | 589 |
| 588 } // namespace views | 590 } // namespace views |
| OLD | NEW |