OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 return; | 408 return; |
409 root_view_->SetContentsView(view); | 409 root_view_->SetContentsView(view); |
410 if (non_client_view_ != view) | 410 if (non_client_view_ != view) |
411 non_client_view_ = NULL; | 411 non_client_view_ = NULL; |
412 } | 412 } |
413 | 413 |
414 View* Widget::GetContentsView() { | 414 View* Widget::GetContentsView() { |
415 return root_view_->GetContentsView(); | 415 return root_view_->GetContentsView(); |
416 } | 416 } |
417 | 417 |
418 gfx::Rect Widget::GetWindowScreenBounds() const { | 418 gfx::Rect Widget::GetWindowBoundsInScreen() const { |
419 return native_widget_->GetWindowScreenBounds(); | 419 return native_widget_->GetWindowBoundsInScreen(); |
420 } | 420 } |
421 | 421 |
422 gfx::Rect Widget::GetClientAreaScreenBounds() const { | 422 gfx::Rect Widget::GetClientAreaBoundsInScreen() const { |
423 return native_widget_->GetClientAreaScreenBounds(); | 423 return native_widget_->GetClientAreaBoundsInScreen(); |
424 } | 424 } |
425 | 425 |
426 gfx::Rect Widget::GetRestoredBounds() const { | 426 gfx::Rect Widget::GetRestoredBounds() const { |
427 return native_widget_->GetRestoredBounds(); | 427 return native_widget_->GetRestoredBounds(); |
428 } | 428 } |
429 | 429 |
430 void Widget::SetBounds(const gfx::Rect& bounds) { | 430 void Widget::SetBounds(const gfx::Rect& bounds) { |
431 native_widget_->SetBounds(bounds); | 431 native_widget_->SetBounds(bounds); |
432 } | 432 } |
433 | 433 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 View* v = widget_delegate_->GetInitiallyFocusedView(); | 884 View* v = widget_delegate_->GetInitiallyFocusedView(); |
885 if (v) | 885 if (v) |
886 v->RequestFocus(); | 886 v->RequestFocus(); |
887 return !!v; | 887 return !!v; |
888 } | 888 } |
889 | 889 |
890 View* Widget::GetChildViewParent() { | 890 View* Widget::GetChildViewParent() { |
891 return GetContentsView() ? GetContentsView() : GetRootView(); | 891 return GetContentsView() ? GetContentsView() : GetRootView(); |
892 } | 892 } |
893 | 893 |
894 gfx::Rect Widget::GetWorkAreaScreenBounds() const { | 894 gfx::Rect Widget::GetWorkAreaBoundsInScreen() const { |
895 return native_widget_->GetWorkAreaScreenBounds(); | 895 return native_widget_->GetWorkAreaBoundsInScreen(); |
896 } | 896 } |
897 | 897 |
898 void Widget::OnOwnerClosing() { | 898 void Widget::OnOwnerClosing() { |
899 } | 899 } |
900 | 900 |
901 //////////////////////////////////////////////////////////////////////////////// | 901 //////////////////////////////////////////////////////////////////////////////// |
902 // Widget, NativeWidgetDelegate implementation: | 902 // Widget, NativeWidgetDelegate implementation: |
903 | 903 |
904 bool Widget::IsModal() const { | 904 bool Widget::IsModal() const { |
905 return widget_delegate_->GetModalType() != ui::MODAL_TYPE_NONE; | 905 return widget_delegate_->GetModalType() != ui::MODAL_TYPE_NONE; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 if (GetRootView()->layer()) { | 1024 if (GetRootView()->layer()) { |
1025 const ui::Transform& layer_transform = GetRootView()->layer()->transform(); | 1025 const ui::Transform& layer_transform = GetRootView()->layer()->transform(); |
1026 if (layer_transform != GetRootView()->GetTransform()) { | 1026 if (layer_transform != GetRootView()->GetTransform()) { |
1027 // The layer has not caught up to the view (i.e., the layer is still | 1027 // The layer has not caught up to the view (i.e., the layer is still |
1028 // animating), and so a clear is required. | 1028 // animating), and so a clear is required. |
1029 force_clear = true; | 1029 force_clear = true; |
1030 } else { | 1030 } else { |
1031 // Determine if the layer fills the client area. | 1031 // Determine if the layer fills the client area. |
1032 gfx::Rect layer_bounds = GetRootView()->layer()->bounds(); | 1032 gfx::Rect layer_bounds = GetRootView()->layer()->bounds(); |
1033 layer_transform.TransformRect(&layer_bounds); | 1033 layer_transform.TransformRect(&layer_bounds); |
1034 gfx::Rect client_bounds = GetClientAreaScreenBounds(); | 1034 gfx::Rect client_bounds = GetClientAreaBoundsInScreen(); |
1035 // Translate bounds to origin (client area bounds are offset to account | 1035 // Translate bounds to origin (client area bounds are offset to account |
1036 // for buttons, etc). | 1036 // for buttons, etc). |
1037 client_bounds.set_origin(gfx::Point(0, 0)); | 1037 client_bounds.set_origin(gfx::Point(0, 0)); |
1038 if (!layer_bounds.Contains(client_bounds)) { | 1038 if (!layer_bounds.Contains(client_bounds)) { |
1039 // It doesn't, and so a clear is required. | 1039 // It doesn't, and so a clear is required. |
1040 force_clear = true; | 1040 force_clear = true; |
1041 } | 1041 } |
1042 } | 1042 } |
1043 } | 1043 } |
1044 | 1044 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1326 |
1327 //////////////////////////////////////////////////////////////////////////////// | 1327 //////////////////////////////////////////////////////////////////////////////// |
1328 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1328 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1329 | 1329 |
1330 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1330 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1331 return this; | 1331 return this; |
1332 } | 1332 } |
1333 | 1333 |
1334 } // namespace internal | 1334 } // namespace internal |
1335 } // namespace views | 1335 } // namespace views |
OLD | NEW |