OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | 1 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 2 // found in the LICENSE file. |
4 | 3 |
5 #include "components/html_viewer/setup.h" | 4 #include "components/html_viewer/setup.h" |
6 | 5 |
7 #include "base/bind.h" | 6 #include "base/bind.h" |
8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
9 #include "base/i18n/icu_util.h" | 8 #include "base/i18n/icu_util.h" |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "components/html_viewer/blink_platform_impl.h" | 10 #include "components/html_viewer/blink_platform_impl.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } // namespace | 63 } // namespace |
65 | 64 |
66 Setup::Setup(mojo::ApplicationImpl* app) | 65 Setup::Setup(mojo::ApplicationImpl* app) |
67 : app_(app), | 66 : app_(app), |
68 resource_loader_(app->shell(), GetResourcePaths()), | 67 resource_loader_(app->shell(), GetResourcePaths()), |
69 is_headless_( | 68 is_headless_( |
70 base::CommandLine::ForCurrentProcess()->HasSwitch(kIsHeadless)), | 69 base::CommandLine::ForCurrentProcess()->HasSwitch(kIsHeadless)), |
71 did_init_(false), | 70 did_init_(false), |
72 device_pixel_ratio_(1.f), | 71 device_pixel_ratio_(1.f), |
73 discardable_memory_allocator_(kDesiredMaxMemory), | 72 discardable_memory_allocator_(kDesiredMaxMemory), |
74 compositor_thread_("compositor thread") { | 73 compositor_thread_("compositor thread"), |
| 74 enable_mojo_media_renderer_( |
| 75 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 76 kEnableMojoMediaRenderer)) { |
75 if (is_headless_) | 77 if (is_headless_) |
76 InitHeadless(); | 78 InitHeadless(); |
77 } | 79 } |
78 | 80 |
79 Setup::~Setup() { | 81 Setup::~Setup() { |
80 } | 82 } |
81 | 83 |
82 void Setup::InitHeadless() { | 84 void Setup::InitHeadless() { |
83 DCHECK(!did_init_); | 85 DCHECK(!did_init_); |
84 is_headless_ = true; | 86 is_headless_ = true; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // TODO(sky): why is this always using 100? | 141 // TODO(sky): why is this always using 100? |
140 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 142 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
141 resource_loader_.ReleaseFile(kResourceUIPak), ui::SCALE_FACTOR_100P); | 143 resource_loader_.ReleaseFile(kResourceUIPak), ui::SCALE_FACTOR_100P); |
142 } | 144 } |
143 | 145 |
144 compositor_thread_.Start(); | 146 compositor_thread_.Start(); |
145 #if defined(OS_ANDROID) | 147 #if defined(OS_ANDROID) |
146 // TODO(sky): Get WebMediaPlayerFactory working on android. | 148 // TODO(sky): Get WebMediaPlayerFactory working on android. |
147 NOTIMPLEMENTED(); | 149 NOTIMPLEMENTED(); |
148 #else | 150 #else |
149 bool enable_mojo_media_renderer = | |
150 command_line->HasSwitch(kEnableMojoMediaRenderer); | |
151 | |
152 web_media_player_factory_.reset(new WebMediaPlayerFactory( | 151 web_media_player_factory_.reset(new WebMediaPlayerFactory( |
153 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer)); | 152 compositor_thread_.message_loop_proxy(), enable_mojo_media_renderer_)); |
154 #endif | 153 #endif |
155 } | 154 } |
156 | 155 |
157 } // namespace html_viewer | 156 } // namespace html_viewer |
OLD | NEW |