Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/test_views_delegate.h" | 5 #include "ui/views/test/test_views_delegate.h" |
| 6 | 6 |
| 7 #include "ui/views/widget/native_widget_mac.h" | 7 #include "ui/views/widget/native_widget_mac.h" |
| 8 | 8 |
| 9 namespace views { | 9 namespace views { |
| 10 | 10 |
| 11 TestViewsDelegate::TestViewsDelegate() | 11 TestViewsDelegate::TestViewsDelegate() |
| 12 : context_factory_(nullptr), | 12 : context_factory_(nullptr), |
| 13 context_factory_private_(nullptr), | 13 context_factory_private_(nullptr), |
| 14 use_desktop_native_widgets_(false), | 14 use_desktop_native_widgets_(false), |
| 15 use_transparent_windows_(false) {} | 15 use_transparent_windows_(false), |
| 16 layout_delegate_(new ViewsLayoutDelegate()) {} | |
|
Peter Kasting
2017/04/04 02:08:56
Nit: MakeUnique
kylix_rd
2017/04/04 20:28:23
Done.
| |
| 16 | 17 |
| 17 TestViewsDelegate::~TestViewsDelegate() { | 18 TestViewsDelegate::~TestViewsDelegate() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 void TestViewsDelegate::OnBeforeWidgetInit( | 21 void TestViewsDelegate::OnBeforeWidgetInit( |
| 21 Widget::InitParams* params, | 22 Widget::InitParams* params, |
| 22 internal::NativeWidgetDelegate* delegate) { | 23 internal::NativeWidgetDelegate* delegate) { |
| 23 if (params->opacity == Widget::InitParams::INFER_OPACITY) { | 24 if (params->opacity == Widget::InitParams::INFER_OPACITY) { |
| 24 params->opacity = use_transparent_windows_ ? | 25 params->opacity = use_transparent_windows_ ? |
| 25 Widget::InitParams::TRANSLUCENT_WINDOW : | 26 Widget::InitParams::TRANSLUCENT_WINDOW : |
| 26 Widget::InitParams::OPAQUE_WINDOW; | 27 Widget::InitParams::OPAQUE_WINDOW; |
| 27 } | 28 } |
| 28 // TODO(tapted): This should return a *Desktop*NativeWidgetMac. | 29 // TODO(tapted): This should return a *Desktop*NativeWidgetMac. |
| 29 if (!params->native_widget && use_desktop_native_widgets_) | 30 if (!params->native_widget && use_desktop_native_widgets_) |
| 30 params->native_widget = new NativeWidgetMac(delegate); | 31 params->native_widget = new NativeWidgetMac(delegate); |
| 31 } | 32 } |
| 32 | 33 |
| 33 ui::ContextFactory* TestViewsDelegate::GetContextFactory() { | 34 ui::ContextFactory* TestViewsDelegate::GetContextFactory() { |
| 34 return context_factory_; | 35 return context_factory_; |
| 35 } | 36 } |
| 36 | 37 |
| 37 ui::ContextFactoryPrivate* TestViewsDelegate::GetContextFactoryPrivate() { | 38 ui::ContextFactoryPrivate* TestViewsDelegate::GetContextFactoryPrivate() { |
| 38 return context_factory_private_; | 39 return context_factory_private_; |
| 39 } | 40 } |
| 40 | 41 |
| 41 const TypographyProvider& TestViewsDelegate::GetTypographyProvider() const { | |
| 42 return typography_provider_; | |
| 43 } | |
| 44 | |
| 45 } // namespace views | 42 } // namespace views |
| OLD | NEW |