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

Side by Side Diff: headless/public/headless_browser.cc

Issue 2199773002: headless: make initial screen/window sizes configurable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove screen size option. Created 4 years, 4 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 | « headless/public/headless_browser.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/public/common/user_agent.h" 5 #include "content/public/common/user_agent.h"
6 #include "headless/public/headless_browser.h" 6 #include "headless/public/headless_browser.h"
7 7
8 using Options = headless::HeadlessBrowser::Options; 8 using Options = headless::HeadlessBrowser::Options;
9 using Builder = headless::HeadlessBrowser::Options::Builder; 9 using Builder = headless::HeadlessBrowser::Options::Builder;
10 10
11 namespace headless { 11 namespace headless {
12 12
13 // Product name for building the default user agent string. 13 // Product name for building the default user agent string.
14 namespace { 14 namespace {
15 const char kProductName[] = "HeadlessChrome"; 15 const char kProductName[] = "HeadlessChrome";
16 const gfx::Size kDefaultWindowSize(800, 600);
Sami 2016/08/02 16:45:33 We shouldn't use non-POD objects as static globals
16 } 17 }
17 18
18 Options::Options(int argc, const char** argv) 19 Options::Options(int argc, const char** argv)
19 : argc(argc), 20 : argc(argc),
20 argv(argv), 21 argv(argv),
21 user_agent(content::BuildUserAgentFromProduct(kProductName)), 22 user_agent(content::BuildUserAgentFromProduct(kProductName)),
22 message_pump(nullptr), 23 message_pump(nullptr),
23 single_process_mode(false), 24 single_process_mode(false),
24 disable_sandbox(false), 25 disable_sandbox(false),
25 gl_implementation("osmesa") {} 26 gl_implementation("osmesa"),
27 window_size(kDefaultWindowSize) {}
26 28
27 Options::Options(Options&& options) = default; 29 Options::Options(Options&& options) = default;
28 30
29 Options::~Options() {} 31 Options::~Options() {}
30 32
31 Options& Options::operator=(Options&& options) = default; 33 Options& Options::operator=(Options&& options) = default;
32 34
33 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} 35 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {}
34 36
35 Builder::Builder() : options_(0, nullptr) {} 37 Builder::Builder() : options_(0, nullptr) {}
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Builder& Builder::SetProtocolHandlers(ProtocolHandlerMap protocol_handlers) { 76 Builder& Builder::SetProtocolHandlers(ProtocolHandlerMap protocol_handlers) {
75 options_.protocol_handlers = std::move(protocol_handlers); 77 options_.protocol_handlers = std::move(protocol_handlers);
76 return *this; 78 return *this;
77 } 79 }
78 80
79 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { 81 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) {
80 options_.gl_implementation = gl_implementation; 82 options_.gl_implementation = gl_implementation;
81 return *this; 83 return *this;
82 } 84 }
83 85
86 Builder& Builder::SetWindowSize(const gfx::Size& window_size) {
87 options_.window_size = window_size;
88 return *this;
89 }
90
84 Options Builder::Build() { 91 Options Builder::Build() {
85 return std::move(options_); 92 return std::move(options_);
86 } 93 }
87 94
88 } // namespace headless 95 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/headless_browser.h ('k') | headless/public/headless_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698