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 #ifndef BLIMP_ENGINE_APP_BLIMP_ENGINE_CONFIG_H_ | |
6 #define BLIMP_ENGINE_APP_BLIMP_ENGINE_CONFIG_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 | |
13 namespace base { | |
14 class CommandLine; | |
15 } // namespace base | |
16 | |
17 namespace blimp { | |
18 namespace engine { | |
19 | |
20 // Set internal command line switches for Blimp engine. | |
21 void SetCommandLineDefaults(base::CommandLine* command_line); | |
22 | |
23 // Class to hold all of the configuration bits necessary for the Blimp engine. | |
24 // | |
25 // The BlimpEngineConfig class is initialized from parameters provided on the | |
26 // command line. For the switches to pass verification: | |
27 // * A client token filepath must be provided and the file must have a | |
28 // non-empty token. | |
29 // | |
30 // The BlimpEngineConfig object is intended to live as long as the engine is | |
31 // running. It should also be one of the first things to be set up. | |
32 class BlimpEngineConfig { | |
33 public: | |
34 ~BlimpEngineConfig(); | |
35 | |
36 // Attempts to create a BlimpEngineConfig based on the parameters in the | |
37 // specified CommandLine. This validates all of the command line switches and | |
38 // parses all files specified. Returns a non-null std::unique_ptr on success. | |
39 static std::unique_ptr<BlimpEngineConfig> Create( | |
40 const base::CommandLine& cmd_line); | |
41 | |
42 // Creates a BlimpEngineConfig based on individual components. Should only | |
43 // be used for testing. | |
44 static std::unique_ptr<BlimpEngineConfig> CreateForTest( | |
45 const std::string& client_auth_token); | |
46 | |
47 // Returns the client token. | |
48 const std::string& client_auth_token() const; | |
49 | |
50 private: | |
51 explicit BlimpEngineConfig(const std::string& client_auth_token); | |
52 | |
53 const std::string client_auth_token_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(BlimpEngineConfig); | |
56 }; | |
57 | |
58 } // namespace engine | |
59 } // namespace blimp | |
60 | |
61 #endif // BLIMP_ENGINE_APP_BLIMP_ENGINE_CONFIG_H_ | |
OLD | NEW |