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/widget.h" | 5 #include "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/l10n/l10n_font_util.h" | 10 #include "ui/base/l10n/l10n_font_util.h" |
11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/compositor/compositor.h" | 12 #include "ui/gfx/compositor/compositor.h" |
| 13 #include "ui/gfx/compositor/layer.h" |
13 #include "views/controls/menu/menu_controller.h" | 14 #include "views/controls/menu/menu_controller.h" |
14 #include "views/focus/focus_manager_factory.h" | 15 #include "views/focus/focus_manager_factory.h" |
15 #include "views/focus/view_storage.h" | 16 #include "views/focus/view_storage.h" |
16 #include "views/ime/input_method.h" | 17 #include "views/ime/input_method.h" |
17 #include "views/views_delegate.h" | 18 #include "views/views_delegate.h" |
18 #include "views/widget/default_theme_provider.h" | 19 #include "views/widget/default_theme_provider.h" |
19 #include "views/widget/root_view.h" | 20 #include "views/widget/root_view.h" |
20 #include "views/widget/native_widget_private.h" | 21 #include "views/widget/native_widget_private.h" |
21 #include "views/widget/tooltip_manager.h" | 22 #include "views/widget/tooltip_manager.h" |
22 #include "views/widget/widget_delegate.h" | 23 #include "views/widget/widget_delegate.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 745 |
745 ui::Compositor* Widget::GetCompositor() { | 746 ui::Compositor* Widget::GetCompositor() { |
746 return native_widget_->GetCompositor(); | 747 return native_widget_->GetCompositor(); |
747 } | 748 } |
748 | 749 |
749 void Widget::MarkLayerDirty() { | 750 void Widget::MarkLayerDirty() { |
750 native_widget_->MarkLayerDirty(); | 751 native_widget_->MarkLayerDirty(); |
751 } | 752 } |
752 | 753 |
753 void Widget::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, | 754 void Widget::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, |
754 View** ancestor) { | 755 ui::Layer** layer_parent) { |
755 native_widget_->CalculateOffsetToAncestorWithLayer(offset, ancestor); | 756 native_widget_->CalculateOffsetToAncestorWithLayer(offset, layer_parent); |
756 } | 757 } |
757 | 758 |
758 void Widget::NotifyAccessibilityEvent( | 759 void Widget::NotifyAccessibilityEvent( |
759 View* view, | 760 View* view, |
760 ui::AccessibilityTypes::Event event_type, | 761 ui::AccessibilityTypes::Event event_type, |
761 bool send_native_event) { | 762 bool send_native_event) { |
762 // Send the notification to the delegate. | 763 // Send the notification to the delegate. |
763 if (ViewsDelegate::views_delegate) | 764 if (ViewsDelegate::views_delegate) |
764 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); | 765 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); |
765 | 766 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 bool Widget::HasFocusManager() const { | 911 bool Widget::HasFocusManager() const { |
911 return !!focus_manager_.get(); | 912 return !!focus_manager_.get(); |
912 } | 913 } |
913 | 914 |
914 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { | 915 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { |
915 ui::Compositor* compositor = GetCompositor(); | 916 ui::Compositor* compositor = GetCompositor(); |
916 if (!compositor) | 917 if (!compositor) |
917 return false; | 918 return false; |
918 | 919 |
919 compositor->NotifyStart(); | 920 compositor->NotifyStart(); |
920 GetRootView()->PaintToLayer(dirty_region); | 921 GetRootView()->layer()->Draw(); |
921 GetRootView()->PaintComposite(); | |
922 compositor->NotifyEnd(); | 922 compositor->NotifyEnd(); |
923 return true; | 923 return true; |
924 } | 924 } |
925 | 925 |
926 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { | 926 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { |
927 GetRootView()->Paint(canvas); | 927 GetRootView()->Paint(canvas); |
928 } | 928 } |
929 | 929 |
930 int Widget::GetNonClientComponent(const gfx::Point& point) { | 930 int Widget::GetNonClientComponent(const gfx::Point& point) { |
931 return non_client_view_ ? non_client_view_->NonClientHitTest(point) : 0; | 931 return non_client_view_ ? non_client_view_->NonClientHitTest(point) : 0; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1145 |
1146 //////////////////////////////////////////////////////////////////////////////// | 1146 //////////////////////////////////////////////////////////////////////////////// |
1147 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1147 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1148 | 1148 |
1149 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1149 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1150 return this; | 1150 return this; |
1151 } | 1151 } |
1152 | 1152 |
1153 } // namespace internal | 1153 } // namespace internal |
1154 } // namespace views | 1154 } // namespace views |
OLD | NEW |