Chromium Code Reviews| 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 #ifndef UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 5 #ifndef UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
| 6 #define UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 6 #define UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "ui/views/style/typography_provider.h" | 12 #include "ui/views/layout/layout_provider.h" |
| 13 #include "ui/views/views_delegate.h" | 13 #include "ui/views/views_delegate.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 class TestViewsDelegate : public ViewsDelegate { | 17 class TestViewsDelegate : public ViewsDelegate { |
| 18 public: | 18 public: |
| 19 TestViewsDelegate(); | 19 TestViewsDelegate(); |
| 20 ~TestViewsDelegate() override; | 20 ~TestViewsDelegate() override; |
| 21 | 21 |
| 22 // If set to |true|, forces widgets that do not provide a native widget to use | 22 // If set to |true|, forces widgets that do not provide a native widget to use |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 33 // Allows tests to provide a ContextFactory via the ViewsDelegate interface. | 33 // Allows tests to provide a ContextFactory via the ViewsDelegate interface. |
| 34 void set_context_factory(ui::ContextFactory* context_factory) { | 34 void set_context_factory(ui::ContextFactory* context_factory) { |
| 35 context_factory_ = context_factory; | 35 context_factory_ = context_factory; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void set_context_factory_private( | 38 void set_context_factory_private( |
| 39 ui::ContextFactoryPrivate* context_factory_private) { | 39 ui::ContextFactoryPrivate* context_factory_private) { |
| 40 context_factory_private_ = context_factory_private; | 40 context_factory_private_ = context_factory_private; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void set_layout_provider(std::unique_ptr<LayoutProvider> layout_provider) { | |
|
Peter Kasting
2017/04/12 21:37:44
Nit: Might want some comments about why this objec
sky
2017/04/12 22:43:58
Given this runs a destructor I wouldn't inline it.
kylix_rd
2017/04/13 16:45:42
Done.
kylix_rd
2017/04/13 16:45:42
There are two separate .cc/mm files, test_views_de
| |
| 44 layout_provider_.swap(layout_provider); | |
| 45 } | |
| 46 | |
| 43 // ViewsDelegate: | 47 // ViewsDelegate: |
| 44 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 45 HICON GetSmallWindowIcon() const override; | 49 HICON GetSmallWindowIcon() const override; |
| 46 #endif | 50 #endif |
| 47 void OnBeforeWidgetInit(Widget::InitParams* params, | 51 void OnBeforeWidgetInit(Widget::InitParams* params, |
| 48 internal::NativeWidgetDelegate* delegate) override; | 52 internal::NativeWidgetDelegate* delegate) override; |
| 49 ui::ContextFactory* GetContextFactory() override; | 53 ui::ContextFactory* GetContextFactory() override; |
| 50 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; | 54 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; |
| 51 const TypographyProvider& GetTypographyProvider() const override; | |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 ui::ContextFactory* context_factory_; | 57 ui::ContextFactory* context_factory_; |
| 55 ui::ContextFactoryPrivate* context_factory_private_; | 58 ui::ContextFactoryPrivate* context_factory_private_; |
| 56 bool use_desktop_native_widgets_; | 59 bool use_desktop_native_widgets_; |
| 57 bool use_transparent_windows_; | 60 bool use_transparent_windows_; |
| 58 DefaultTypographyProvider typography_provider_; | 61 std::unique_ptr<LayoutProvider> layout_provider_; |
| 59 | 62 |
| 60 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 } // namespace views | 66 } // namespace views |
| 64 | 67 |
| 65 #endif // UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 68 #endif // UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
| OLD | NEW |