1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "content/public/browser/service_process_host.h" 6 7 #include "base/strings/utf_string_conversions.h" 8 #include "content/public/common/content_client.h" 9 10 namespace content { 11 12 ServiceProcessHost::Options::Options() = default; 13 14 ServiceProcessHost::Options::~Options() = default; 15 16 ServiceProcessHost::Options::Options(Options&&) = default; 17 WithSandboxType(SandboxType type)18ServiceProcessHost::Options& ServiceProcessHost::Options::WithSandboxType( 19 SandboxType type) { 20 sandbox_type = type; 21 return *this; 22 } 23 WithDisplayName(const std::string & name)24ServiceProcessHost::Options& ServiceProcessHost::Options::WithDisplayName( 25 const std::string& name) { 26 display_name = base::UTF8ToUTF16(name); 27 return *this; 28 } 29 WithDisplayName(const base::string16 & name)30ServiceProcessHost::Options& ServiceProcessHost::Options::WithDisplayName( 31 const base::string16& name) { 32 display_name = name; 33 return *this; 34 } 35 WithDisplayName(int resource_id)36ServiceProcessHost::Options& ServiceProcessHost::Options::WithDisplayName( 37 int resource_id) { 38 display_name = GetContentClient()->GetLocalizedString(resource_id); 39 return *this; 40 } 41 WithChildFlags(int flags)42ServiceProcessHost::Options& ServiceProcessHost::Options::WithChildFlags( 43 int flags) { 44 child_flags = flags; 45 return *this; 46 } 47 48 ServiceProcessHost::Options& WithExtraCommandLineSwitches(std::vector<std::string> switches)49ServiceProcessHost::Options::WithExtraCommandLineSwitches( 50 std::vector<std::string> switches) { 51 extra_switches = std::move(switches); 52 return *this; 53 } 54 Pass()55ServiceProcessHost::Options ServiceProcessHost::Options::Pass() { 56 return std::move(*this); 57 } 58 59 } // namespace content 60