| 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 740 } |
| 740 | 741 |
| 741 const ui::Compositor* Widget::GetCompositor() const { | 742 const ui::Compositor* Widget::GetCompositor() const { |
| 742 return native_widget_->GetCompositor(); | 743 return native_widget_->GetCompositor(); |
| 743 } | 744 } |
| 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 native_widget_->MarkLayerDirty(); | |
| 751 } | |
| 752 | |
| 753 void Widget::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, | 750 void Widget::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, |
| 754 View** ancestor) { | 751 ui::Layer** layer_parent) { |
| 755 native_widget_->CalculateOffsetToAncestorWithLayer(offset, ancestor); | 752 native_widget_->CalculateOffsetToAncestorWithLayer(offset, layer_parent); |
| 756 } | 753 } |
| 757 | 754 |
| 758 void Widget::NotifyAccessibilityEvent( | 755 void Widget::NotifyAccessibilityEvent( |
| 759 View* view, | 756 View* view, |
| 760 ui::AccessibilityTypes::Event event_type, | 757 ui::AccessibilityTypes::Event event_type, |
| 761 bool send_native_event) { | 758 bool send_native_event) { |
| 762 // Send the notification to the delegate. | 759 // Send the notification to the delegate. |
| 763 if (ViewsDelegate::views_delegate) | 760 if (ViewsDelegate::views_delegate) |
| 764 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); | 761 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); |
| 765 | 762 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 bool Widget::HasFocusManager() const { | 907 bool Widget::HasFocusManager() const { |
| 911 return !!focus_manager_.get(); | 908 return !!focus_manager_.get(); |
| 912 } | 909 } |
| 913 | 910 |
| 914 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { | 911 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { |
| 915 ui::Compositor* compositor = GetCompositor(); | 912 ui::Compositor* compositor = GetCompositor(); |
| 916 if (!compositor) | 913 if (!compositor) |
| 917 return false; | 914 return false; |
| 918 | 915 |
| 919 compositor->NotifyStart(); | 916 compositor->NotifyStart(); |
| 920 GetRootView()->PaintToLayer(dirty_region); | 917 GetRootView()->layer()->Draw(); |
| 921 GetRootView()->PaintComposite(); | |
| 922 compositor->NotifyEnd(); | 918 compositor->NotifyEnd(); |
| 923 return true; | 919 return true; |
| 924 } | 920 } |
| 925 | 921 |
| 926 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { | 922 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { |
| 927 GetRootView()->Paint(canvas); | 923 GetRootView()->Paint(canvas); |
| 928 } | 924 } |
| 929 | 925 |
| 930 int Widget::GetNonClientComponent(const gfx::Point& point) { | 926 int Widget::GetNonClientComponent(const gfx::Point& point) { |
| 931 return non_client_view_ ? non_client_view_->NonClientHitTest(point) : 0; | 927 return non_client_view_ ? non_client_view_->NonClientHitTest(point) : 0; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1141 |
| 1146 //////////////////////////////////////////////////////////////////////////////// | 1142 //////////////////////////////////////////////////////////////////////////////// |
| 1147 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1143 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1148 | 1144 |
| 1149 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1145 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1150 return this; | 1146 return this; |
| 1151 } | 1147 } |
| 1152 | 1148 |
| 1153 } // namespace internal | 1149 } // namespace internal |
| 1154 } // namespace views | 1150 } // namespace views |
| OLD | NEW |