electron_command_line.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_ELECTRON_COMMAND_LINE_H_
  5. #define ELECTRON_SHELL_COMMON_ELECTRON_COMMAND_LINE_H_
  6. #include "base/command_line.h"
  7. #include "build/build_config.h"
  8. namespace electron {
  9. // Singleton to remember the original "argc" and "argv".
  10. class ElectronCommandLine {
  11. public:
  12. // disable copy
  13. ElectronCommandLine() = delete;
  14. ElectronCommandLine(const ElectronCommandLine&) = delete;
  15. ElectronCommandLine& operator=(const ElectronCommandLine&) = delete;
  16. static const base::CommandLine::StringVector& argv() { return argv_; }
  17. static void Init(int argc, base::CommandLine::CharType** argv);
  18. #if BUILDFLAG(IS_LINUX)
  19. // On Linux the command line has to be read from base::CommandLine since
  20. // it is using zygote.
  21. static void InitializeFromCommandLine();
  22. #endif
  23. private:
  24. static base::CommandLine::StringVector argv_;
  25. };
  26. } // namespace electron
  27. #endif // ELECTRON_SHELL_COMMON_ELECTRON_COMMAND_LINE_H_