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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "chrome/test/base/view_event_test_platform_part.h" | 8 #include "chrome/test/base/view_event_test_platform_part.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/display/screen.h" |
11 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 11 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. | 15 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. |
16 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { | 16 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { |
17 public: | 17 public: |
18 explicit ViewEventTestPlatformPartDefault( | 18 explicit ViewEventTestPlatformPartDefault( |
19 ui::ContextFactory* context_factory) { | 19 ui::ContextFactory* context_factory) { |
20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
21 screen_.reset(views::CreateDesktopScreen()); | 21 screen_.reset(views::CreateDesktopScreen()); |
22 gfx::Screen::SetScreenInstance(screen_.get()); | 22 display::Screen::SetScreenInstance(screen_.get()); |
23 env_ = aura::Env::CreateInstance(); | 23 env_ = aura::Env::CreateInstance(); |
24 env_->set_context_factory(context_factory); | 24 env_->set_context_factory(context_factory); |
25 #endif | 25 #endif |
26 } | 26 } |
27 | 27 |
28 ~ViewEventTestPlatformPartDefault() override { | 28 ~ViewEventTestPlatformPartDefault() override { |
29 #if defined(USE_AURA) | 29 #if defined(USE_AURA) |
30 env_.reset(); | 30 env_.reset(); |
31 gfx::Screen::SetScreenInstance(nullptr); | 31 display::Screen::SetScreenInstance(nullptr); |
32 #endif | 32 #endif |
33 } | 33 } |
34 | 34 |
35 // Overridden from ViewEventTestPlatformPart: | 35 // Overridden from ViewEventTestPlatformPart: |
36 gfx::NativeWindow GetContext() override { return NULL; } | 36 gfx::NativeWindow GetContext() override { return NULL; } |
37 | 37 |
38 private: | 38 private: |
39 std::unique_ptr<gfx::Screen> screen_; | 39 std::unique_ptr<display::Screen> screen_; |
40 std::unique_ptr<aura::Env> env_; | 40 std::unique_ptr<aura::Env> env_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); | 42 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 // static | 47 // static |
48 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 48 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
49 ui::ContextFactory* context_factory) { | 49 ui::ContextFactory* context_factory) { |
50 return new ViewEventTestPlatformPartDefault(context_factory); | 50 return new ViewEventTestPlatformPartDefault(context_factory); |
51 } | 51 } |
OLD | NEW |