OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "blimp/engine/app/blimp_engine_config.h" | |
6 | |
7 #include <memory> | |
8 #include <string> | |
9 | |
10 #include "base/base_switches.h" | |
11 #include "base/command_line.h" | |
12 #include "base/files/file_path.h" | |
13 #include "base/files/file_util.h" | |
14 #include "base/memory/ptr_util.h" | |
15 #include "base/strings/string_util.h" | |
16 #include "blimp/common/get_client_auth_token.h" | |
17 #include "cc/base/switches.h" | |
18 #include "content/public/common/content_switches.h" | |
19 #include "ui/gl/gl_switches.h" | |
20 #include "ui/native_theme/native_theme_switches.h" | |
21 | |
22 namespace blimp { | |
23 namespace engine { | |
24 | |
25 void SetCommandLineDefaults(base::CommandLine* command_line) { | |
26 command_line->AppendSwitch(::switches::kEnableOverlayScrollbar); | |
27 command_line->AppendSwitch(::switches::kEnableViewport); | |
28 command_line->AppendSwitch(cc::switches::kDisableCachedPictureRaster); | |
29 command_line->AppendSwitch(::switches::kDisableGpu); | |
30 command_line->AppendSwitch( | |
31 "disable-remote-fonts"); // switches::kDisableRemoteFonts is not visible. | |
32 command_line->AppendSwitch(::switches::kUseRemoteCompositing); | |
33 command_line->AppendSwitchASCII( | |
34 ::switches::kUseGL, | |
35 "osmesa"); // Avoid invoking gpu::CollectDriverVersionNVidia. | |
36 | |
37 // Disable threaded animation since we don't support them right now. | |
38 // (crbug/570376). | |
39 command_line->AppendSwitch(cc::switches::kDisableThreadedAnimation); | |
40 | |
41 // Disable use-zoom-for-dsf since it ends up overriding the device scale | |
42 // factor reported to the client. See crbug.com/654898. | |
43 command_line->AppendSwitchASCII(::switches::kEnableUseZoomForDSF, "false"); | |
44 } | |
45 | |
46 BlimpEngineConfig::~BlimpEngineConfig() {} | |
47 | |
48 // static | |
49 std::unique_ptr<BlimpEngineConfig> BlimpEngineConfig::Create( | |
50 const base::CommandLine& cmd_line) { | |
51 const std::string client_auth_token = GetClientAuthToken(cmd_line); | |
52 if (!client_auth_token.empty()) { | |
53 return base::WrapUnique(new BlimpEngineConfig(client_auth_token)); | |
54 } | |
55 return nullptr; | |
56 } | |
57 | |
58 // static | |
59 std::unique_ptr<BlimpEngineConfig> BlimpEngineConfig::CreateForTest( | |
60 const std::string& client_auth_token) { | |
61 return base::WrapUnique(new BlimpEngineConfig(client_auth_token)); | |
62 } | |
63 | |
64 const std::string& BlimpEngineConfig::client_auth_token() const { | |
65 return client_auth_token_; | |
66 } | |
67 | |
68 BlimpEngineConfig::BlimpEngineConfig(const std::string& client_auth_token) | |
69 : client_auth_token_(client_auth_token) {} | |
70 | |
71 } // namespace engine | |
72 } // namespace blimp | |
OLD | NEW |