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

Side by Side Diff: mojo/services/html_viewer/html_viewer.cc

Issue 1002033004: Gets packaging of html_viewer for android working (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 5 years, 9 months 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 | « mojo/services/html_viewer/android/java/org/chromium/html_viewer/Main.java ('k') | no next file » | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 public: 163 public:
164 HTMLViewer() : compositor_thread_("compositor thread") {} 164 HTMLViewer() : compositor_thread_("compositor thread") {}
165 165
166 ~HTMLViewer() override { blink::shutdown(); } 166 ~HTMLViewer() override { blink::shutdown(); }
167 167
168 private: 168 private:
169 // Overridden from ApplicationDelegate: 169 // Overridden from ApplicationDelegate:
170 void Initialize(mojo::ApplicationImpl* app) override { 170 void Initialize(mojo::ApplicationImpl* app) override {
171 blink_platform_.reset(new MojoBlinkPlatformImpl(app)); 171 blink_platform_.reset(new MojoBlinkPlatformImpl(app));
172 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 172 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
173 // Note: this requires file system access.
173 gin::IsolateHolder::LoadV8Snapshot(); 174 gin::IsolateHolder::LoadV8Snapshot();
174 #endif 175 #endif
175 blink::initialize(blink_platform_.get()); 176 blink::initialize(blink_platform_.get());
176 base::i18n::InitializeICU(); 177 base::i18n::InitializeICU();
177 178
178 ui::RegisterPathProvider(); 179 ui::RegisterPathProvider();
179 180
180 base::CommandLine::StringVector command_line_args; 181 base::CommandLine::StringVector command_line_args;
181 #if defined(OS_WIN) 182 #if defined(OS_WIN)
182 for (const auto& arg : app->args()) 183 for (const auto& arg : app->args())
183 command_line_args.push_back(base::UTF8ToUTF16(arg)); 184 command_line_args.push_back(base::UTF8ToUTF16(arg));
184 #elif defined(OS_POSIX) 185 #elif defined(OS_POSIX)
185 command_line_args = app->args(); 186 command_line_args = app->args();
186 #endif 187 #endif
187 188
188 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 189 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
189 command_line->InitFromArgv(command_line_args); 190 command_line->InitFromArgv(command_line_args);
190 191
191 logging::LoggingSettings settings; 192 logging::LoggingSettings settings;
192 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 193 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
193 logging::InitLogging(settings); 194 logging::InitLogging(settings);
194 // Display process ID, thread ID and timestamp in logs. 195 // Display process ID, thread ID and timestamp in logs.
195 logging::SetLogItems(true, true, true, false); 196 logging::SetLogItems(true, true, true, false);
196 197
197 if (command_line->HasSwitch(kDisableEncryptedMedia)) 198 if (command_line->HasSwitch(kDisableEncryptedMedia))
198 blink::WebRuntimeFeatures::enableEncryptedMedia(false); 199 blink::WebRuntimeFeatures::enableEncryptedMedia(false);
199 200
200 is_headless_ = command_line->HasSwitch(kIsHeadless); 201 is_headless_ = command_line->HasSwitch(kIsHeadless);
201 if (!is_headless_) { 202 if (!is_headless_) {
203 // TODO(sky): consider putting this into the .so so that we don't need
204 // file system access.
202 base::FilePath ui_test_pak_path; 205 base::FilePath ui_test_pak_path;
203 CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); 206 CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
204 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); 207 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
205 } 208 }
206 209
207 compositor_thread_.Start(); 210 compositor_thread_.Start();
208 #if defined(OS_ANDROID) 211 #if defined(OS_ANDROID)
209 // TODO(sky): Get WebMediaPlayerFactory working on android. 212 // TODO(sky): Get WebMediaPlayerFactory working on android.
210 NOTIMPLEMENTED(); 213 NOTIMPLEMENTED();
211 #else 214 #else
(...skipping 27 matching lines...) Expand all
239 242
240 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); 243 DISALLOW_COPY_AND_ASSIGN(HTMLViewer);
241 }; 244 };
242 245
243 } // namespace html_viewer 246 } // namespace html_viewer
244 247
245 MojoResult MojoMain(MojoHandle shell_handle) { 248 MojoResult MojoMain(MojoHandle shell_handle) {
246 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer); 249 mojo::ApplicationRunnerChromium runner(new html_viewer::HTMLViewer);
247 return runner.Run(shell_handle); 250 return runner.Run(shell_handle);
248 } 251 }
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/android/java/org/chromium/html_viewer/Main.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698