Chromium Code Reviews| 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 "blimp/engine/app/blimp_engine_config.h" | 5 #include "blimp/engine/app/blimp_engine_config.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "blimp/engine/app/switches.h" | 16 #include "blimp/common/get_client_token.h" |
| 17 #include "blimp/common/switches.h" | |
|
Kevin M
2016/05/11 00:39:57
Do we need to include this file, now that GetClien
CJ
2016/05/11 23:48:50
Done.
| |
| 17 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
| 18 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
| 19 #include "ui/gl/gl_switches.h" | 20 #include "ui/gl/gl_switches.h" |
| 20 #include "ui/native_theme/native_theme_switches.h" | 21 #include "ui/native_theme/native_theme_switches.h" |
| 21 | 22 |
| 22 namespace blimp { | 23 namespace blimp { |
| 23 namespace engine { | 24 namespace engine { |
| 24 | 25 |
| 25 namespace { | |
| 26 // Gets the client token from the file provided by the command line. If a read | |
| 27 // does not succeed, or the switch is malformed, an empty string is returned. | |
| 28 std::string GetClientToken(const base::CommandLine& cmd_line) { | |
| 29 std::string file_contents; | |
| 30 const base::FilePath path = cmd_line.GetSwitchValuePath(kClientTokenPath); | |
| 31 if (!base::ReadFileToString(path, &file_contents)) { | |
| 32 LOG(ERROR) << "Could not read client token file at " | |
| 33 << (path.empty() ? "(not provided)" : path.AsUTF8Unsafe()); | |
| 34 } | |
| 35 return base::CollapseWhitespaceASCII(file_contents, true); | |
| 36 } | |
| 37 } // namespace | |
| 38 | |
| 39 void SetCommandLineDefaults(base::CommandLine* command_line) { | 26 void SetCommandLineDefaults(base::CommandLine* command_line) { |
| 40 command_line->AppendSwitch(::switches::kEnableOverlayScrollbar); | 27 command_line->AppendSwitch(::switches::kEnableOverlayScrollbar); |
| 41 command_line->AppendSwitch(cc::switches::kDisableCachedPictureRaster); | 28 command_line->AppendSwitch(cc::switches::kDisableCachedPictureRaster); |
| 42 command_line->AppendSwitch(::switches::kDisableGpu); | 29 command_line->AppendSwitch(::switches::kDisableGpu); |
| 43 command_line->AppendSwitch( | 30 command_line->AppendSwitch( |
| 44 "disable-remote-fonts"); // switches::kDisableRemoteFonts is not visible. | 31 "disable-remote-fonts"); // switches::kDisableRemoteFonts is not visible. |
| 45 command_line->AppendSwitch(::switches::kUseRemoteCompositing); | 32 command_line->AppendSwitch(::switches::kUseRemoteCompositing); |
| 46 command_line->AppendSwitchASCII( | 33 command_line->AppendSwitchASCII( |
| 47 ::switches::kUseGL, | 34 ::switches::kUseGL, |
| 48 "osmesa"); // Avoid invoking gpu::CollectDriverVersionNVidia. | 35 "osmesa"); // Avoid invoking gpu::CollectDriverVersionNVidia. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 68 | 55 |
| 69 const std::string& BlimpEngineConfig::client_token() const { | 56 const std::string& BlimpEngineConfig::client_token() const { |
| 70 return client_token_; | 57 return client_token_; |
| 71 } | 58 } |
| 72 | 59 |
| 73 BlimpEngineConfig::BlimpEngineConfig(const std::string& client_token) | 60 BlimpEngineConfig::BlimpEngineConfig(const std::string& client_token) |
| 74 : client_token_(client_token) {} | 61 : client_token_(client_token) {} |
| 75 | 62 |
| 76 } // namespace engine | 63 } // namespace engine |
| 77 } // namespace blimp | 64 } // namespace blimp |
| OLD | NEW |