#pragma once #include #include "include/base/cef_macros.h" class Process { public: Process() = default; Process(const std::string& path, const std::string& args = "", const std::string& workDir = "") : path_(path), args_(args), workDir_(workDir) {} virtual ~Process() { } static Process* Create(); static Process* Create(const std::string& path, const std::string& args = "", const std::string& workDir = ""); void SetWorkingDirectory(const std::string& dir) { workDir_ = dir; } bool Excucete() { return OnExecute(); } bool Excucete(const std::string& path) { path_ = path; return OnExecute(); } bool Excucete(const std::string& path, const std::string& args) { path_ = path; args_ = args; return OnExecute(); } void Terminate() { OnTerminate(); } protected: virtual bool OnExecute() = 0; virtual void OnTerminate() = 0; protected: std::string path_; std::string args_; std::string workDir_; DISALLOW_COPY_AND_ASSIGN(Process); };