| OLD | NEW |
| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const GURL& initial_url, | 80 const GURL& initial_url, |
| 81 const gfx::Size& size) { | 81 const gfx::Size& size) { |
| 82 return CreateWebContentsBuilder() | 82 return CreateWebContentsBuilder() |
| 83 .SetInitialURL(initial_url) | 83 .SetInitialURL(initial_url) |
| 84 .SetWindowSize(size) | 84 .SetWindowSize(size) |
| 85 .Build(); | 85 .Build(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 scoped_refptr<base::SingleThreadTaskRunner> | 88 scoped_refptr<base::SingleThreadTaskRunner> |
| 89 HeadlessBrowserImpl::BrowserMainThread() const { | 89 HeadlessBrowserImpl::BrowserMainThread() const { |
| 90 return content::BrowserThread::GetMessageLoopProxyForThread( | 90 return content::BrowserThread::GetTaskRunnerForThread( |
| 91 content::BrowserThread::UI); | 91 content::BrowserThread::UI); |
| 92 } | 92 } |
| 93 | 93 |
| 94 scoped_refptr<base::SingleThreadTaskRunner> | 94 scoped_refptr<base::SingleThreadTaskRunner> |
| 95 HeadlessBrowserImpl::BrowserFileThread() const { | 95 HeadlessBrowserImpl::BrowserFileThread() const { |
| 96 return content::BrowserThread::GetMessageLoopProxyForThread( | 96 return content::BrowserThread::GetTaskRunnerForThread( |
| 97 content::BrowserThread::FILE); | 97 content::BrowserThread::FILE); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void HeadlessBrowserImpl::Shutdown() { | 100 void HeadlessBrowserImpl::Shutdown() { |
| 101 DCHECK(BrowserMainThread()->BelongsToCurrentThread()); | 101 DCHECK(BrowserMainThread()->BelongsToCurrentThread()); |
| 102 BrowserMainThread()->PostTask(FROM_HERE, | 102 BrowserMainThread()->PostTask(FROM_HERE, |
| 103 base::MessageLoop::QuitWhenIdleClosure()); | 103 base::MessageLoop::QuitWhenIdleClosure()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 std::vector<HeadlessWebContents*> HeadlessBrowserImpl::GetAllWebContents() { | 106 std::vector<HeadlessWebContents*> HeadlessBrowserImpl::GetAllWebContents() { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 // Child processes should not end up here. | 194 // Child processes should not end up here. |
| 195 base::CommandLine command_line(options.argc, options.argv); | 195 base::CommandLine command_line(options.argc, options.argv); |
| 196 DCHECK(!command_line.HasSwitch(switches::kProcessType)); | 196 DCHECK(!command_line.HasSwitch(switches::kProcessType)); |
| 197 #endif | 197 #endif |
| 198 return RunContentMain(std::move(options), | 198 return RunContentMain(std::move(options), |
| 199 std::move(on_browser_start_callback)); | 199 std::move(on_browser_start_callback)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace headless | 202 } // namespace headless |
| OLD | NEW |