Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/test/base/view_event_test_platform_part_default.cc

Issue 2563783002: ui + mus: Split ContextFactory into ContextFactory(Client) and ContextFactoryPrivate (Closed)
Patch Set: Restore mash Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/base/view_event_test_platform_part_chromeos.cc ('k') | components/exo/surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/display/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 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) 13 #if !defined(OS_CHROMEOS) && defined(OS_LINUX)
14 #include "ui/views/test/test_desktop_screen_x11.h" 14 #include "ui/views/test/test_desktop_screen_x11.h"
15 #endif 15 #endif
16 16
17 namespace { 17 namespace {
18 18
19 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. 19 // ViewEventTestPlatformPart implementation for Views, but non-CrOS.
20 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { 20 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart {
21 public: 21 public:
22 explicit ViewEventTestPlatformPartDefault( 22 ViewEventTestPlatformPartDefault(
23 ui::ContextFactory* context_factory) { 23 ui::ContextFactory* context_factory,
24 ui::ContextFactoryPrivate* context_factory_private) {
24 #if defined(USE_AURA) 25 #if defined(USE_AURA)
25 DCHECK(!display::Screen::GetScreen()); 26 DCHECK(!display::Screen::GetScreen());
26 #if defined(USE_X11) && !defined(OS_CHROMEOS) 27 #if defined(USE_X11) && !defined(OS_CHROMEOS)
27 display::Screen::SetScreenInstance( 28 display::Screen::SetScreenInstance(
28 views::test::TestDesktopScreenX11::GetInstance()); 29 views::test::TestDesktopScreenX11::GetInstance());
29 #else 30 #else
30 screen_.reset(views::CreateDesktopScreen()); 31 screen_.reset(views::CreateDesktopScreen());
31 display::Screen::SetScreenInstance(screen_.get()); 32 display::Screen::SetScreenInstance(screen_.get());
32 #endif 33 #endif
33 env_ = aura::Env::CreateInstance(); 34 env_ = aura::Env::CreateInstance();
34 env_->set_context_factory(context_factory); 35 env_->set_context_factory(context_factory);
36 env_->set_context_factory_private(context_factory_private);
35 #endif 37 #endif
36 } 38 }
37 39
38 ~ViewEventTestPlatformPartDefault() override { 40 ~ViewEventTestPlatformPartDefault() override {
39 #if defined(USE_AURA) 41 #if defined(USE_AURA)
40 env_.reset(); 42 env_.reset();
41 display::Screen::SetScreenInstance(nullptr); 43 display::Screen::SetScreenInstance(nullptr);
42 #endif 44 #endif
43 } 45 }
44 46
45 // Overridden from ViewEventTestPlatformPart: 47 // Overridden from ViewEventTestPlatformPart:
46 gfx::NativeWindow GetContext() override { return NULL; } 48 gfx::NativeWindow GetContext() override { return NULL; }
47 49
48 private: 50 private:
49 std::unique_ptr<display::Screen> screen_; 51 std::unique_ptr<display::Screen> screen_;
50 std::unique_ptr<aura::Env> env_; 52 std::unique_ptr<aura::Env> env_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); 54 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault);
53 }; 55 };
54 56
55 } // namespace 57 } // namespace
56 58
57 // static 59 // static
58 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( 60 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
59 ui::ContextFactory* context_factory) { 61 ui::ContextFactory* context_factory,
60 return new ViewEventTestPlatformPartDefault(context_factory); 62 ui::ContextFactoryPrivate* context_factory_private) {
63 return new ViewEventTestPlatformPartDefault(context_factory,
64 context_factory_private);
61 } 65 }
OLDNEW
« no previous file with comments | « chrome/test/base/view_event_test_platform_part_chromeos.cc ('k') | components/exo/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698