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

Side by Side Diff: headless/lib/browser/headless_browser_impl.cc

Issue 2624343002: Get headless_shell building on Windows. (Closed)
Patch Set: Remove headless_shell addition to chrome windows build Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "headless/lib/browser/headless_browser_impl.h" 5 #include "headless/lib/browser/headless_browser_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "content/public/app/content_main.h" 14 #include "content/public/app/content_main.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "headless/lib/browser/headless_browser_context_impl.h" 18 #include "headless/lib/browser/headless_browser_context_impl.h"
19 #include "headless/lib/browser/headless_browser_main_parts.h" 19 #include "headless/lib/browser/headless_browser_main_parts.h"
20 #include "headless/lib/browser/headless_web_contents_impl.h" 20 #include "headless/lib/browser/headless_web_contents_impl.h"
21 #include "headless/lib/headless_content_main_delegate.h" 21 #include "headless/lib/headless_content_main_delegate.h"
22 #include "ui/aura/client/focus_client.h" 22 #include "ui/aura/client/focus_client.h"
23 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
24 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
25 #include "ui/events/devices/device_data_manager.h" 25 #include "ui/events/devices/device_data_manager.h"
26 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
27 27
28 #if defined(OS_WIN)
29 #include "content/public/app/sandbox_helper_win.h"
30 #include "sandbox/win/src/sandbox_types.h"
31 #endif
32
28 namespace headless { 33 namespace headless {
29 namespace { 34 namespace {
30 35
31 int RunContentMain( 36 int RunContentMain(
32 HeadlessBrowser::Options options, 37 HeadlessBrowser::Options options,
33 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) { 38 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) {
34 content::ContentMainParams params(nullptr); 39 content::ContentMainParams params(nullptr);
40 #if defined(OS_WIN)
41 sandbox::SandboxInterfaceInfo sandbox_info = {0};
42 content::InitializeSandboxInfo(&sandbox_info);
43 params.sandbox_info = &sandbox_info;
44 #elif !defined(OS_ANDROID)
35 params.argc = options.argc; 45 params.argc = options.argc;
36 params.argv = options.argv; 46 params.argv = options.argv;
47 #endif
37 48
38 // TODO(skyostil): Implement custom message pumps. 49 // TODO(skyostil): Implement custom message pumps.
39 DCHECK(!options.message_pump); 50 DCHECK(!options.message_pump);
40 51
41 std::unique_ptr<HeadlessBrowserImpl> browser( 52 std::unique_ptr<HeadlessBrowserImpl> browser(
42 new HeadlessBrowserImpl(on_browser_start_callback, std::move(options))); 53 new HeadlessBrowserImpl(on_browser_start_callback, std::move(options)));
43 headless::HeadlessContentMainDelegate delegate(std::move(browser)); 54 headless::HeadlessContentMainDelegate delegate(std::move(browser));
44 params.delegate = &delegate; 55 params.delegate = &delegate;
45 return content::ContentMain(params); 56 return content::ContentMain(params);
46 } 57 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 221
211 // Child processes should not end up here. 222 // Child processes should not end up here.
212 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( 223 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
213 switches::kProcessType)); 224 switches::kProcessType));
214 #endif 225 #endif
215 return RunContentMain(std::move(options), 226 return RunContentMain(std::move(options),
216 std::move(on_browser_start_callback)); 227 std::move(on_browser_start_callback));
217 } 228 }
218 229
219 } // namespace headless 230 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698