OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
9 #include "ui/ozone/ozone_platform.h" | 9 #include "ui/ozone/ozone_platform.h" |
10 #include "ui/ozone/ozone_platform_list.h" | 10 #include "ui/ozone/ozone_platform_list.h" |
11 #include "ui/ozone/ozone_switches.h" | 11 #include "ui/ozone/ozone_switches.h" |
| 12 #include "ui/ozone/window/window_factory_ozone.h" |
12 | 13 |
13 namespace ui { | 14 namespace ui { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 // Helper to construct an OzonePlatform by name using the platform list. | 18 // Helper to construct an OzonePlatform by name using the platform list. |
18 OzonePlatform* CreatePlatform(const std::string& platform_name) { | 19 OzonePlatform* CreatePlatform(const std::string& platform_name) { |
19 // Search for a matching platform in the list. | 20 // Search for a matching platform in the list. |
20 for (int i = 0; i < kOzonePlatformCount; ++i) | 21 for (int i = 0; i < kOzonePlatformCount; ++i) |
21 if (platform_name == kOzonePlatforms[i].name) | 22 if (platform_name == kOzonePlatforms[i].name) |
(...skipping 14 matching lines...) Expand all Loading... |
36 } | 37 } |
37 | 38 |
38 } // namespace | 39 } // namespace |
39 | 40 |
40 OzonePlatform::OzonePlatform() {} | 41 OzonePlatform::OzonePlatform() {} |
41 | 42 |
42 OzonePlatform::~OzonePlatform() { | 43 OzonePlatform::~OzonePlatform() { |
43 gfx::SurfaceFactoryOzone::SetInstance(NULL); | 44 gfx::SurfaceFactoryOzone::SetInstance(NULL); |
44 ui::EventFactoryOzone::SetInstance(NULL); | 45 ui::EventFactoryOzone::SetInstance(NULL); |
45 ui::CursorFactoryOzone::SetInstance(NULL); | 46 ui::CursorFactoryOzone::SetInstance(NULL); |
| 47 ui::WindowFactoryOzone::SetInstance(NULL); |
46 } | 48 } |
47 | 49 |
48 // static | 50 // static |
49 void OzonePlatform::Initialize() { | 51 void OzonePlatform::Initialize() { |
50 if (instance_) | 52 if (instance_) |
51 return; | 53 return; |
52 | 54 |
53 std::string platform = GetPlatformName(); | 55 std::string platform = GetPlatformName(); |
54 | 56 |
55 TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform); | 57 TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform); |
56 | 58 |
57 instance_ = CreatePlatform(platform); | 59 instance_ = CreatePlatform(platform); |
58 | 60 |
59 // Inject ozone interfaces. | 61 // Inject ozone interfaces. |
60 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone()); | 62 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone()); |
61 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone()); | 63 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone()); |
62 ui::InputMethodContextFactoryOzone::SetInstance( | 64 ui::InputMethodContextFactoryOzone::SetInstance( |
63 instance_->GetInputMethodContextFactoryOzone()); | 65 instance_->GetInputMethodContextFactoryOzone()); |
64 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone()); | 66 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone()); |
| 67 ui::WindowFactoryOzone::SetInstance(instance_->GetWindowFactoryOzone()); |
65 } | 68 } |
66 | 69 |
67 // static | 70 // static |
68 OzonePlatform* OzonePlatform::instance_; | 71 OzonePlatform* OzonePlatform::instance_; |
69 | 72 |
70 } // namespace ui | 73 } // namespace ui |
OLD | NEW |