1 : // Copyright 2016 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : #ifndef SYZYGY_KASKO_KASKO_UPLOAD_APP_H_
15 : #define SYZYGY_KASKO_KASKO_UPLOAD_APP_H_
16 :
17 : #include "base/files/file_path.h"
18 : #include "syzygy/application/application.h"
19 :
20 m : namespace kasko {
21 :
22 : // The application class that takes care of uploading a minidump and matching
23 : // crash key file.
24 m : class KaskoUploadApp : public application::AppImplBase {
25 m : public:
26 : // Return codes from 'Run'. These constants should be kept the same so that
27 : // any scripts depending on them continue to work.
28 m : enum ReturnCodes : int {
29 : // This is by convention.
30 m : kReturnCodeSuccess = 0,
31 : // This is imposed by the application base class.
32 m : kReturnCodeInvalidCommandLine = 1,
33 : // These are custom return codes used by this application.
34 m : kReturnCodeCrashKeysFileMissing = 2,
35 m : kReturnCodeCrashKeysFileMalformed = 3,
36 m : kReturnCodeCrashKeysAbsent = 4,
37 m : kReturnCodeMinidumpFileMissing = 5,
38 m : kReturnCodeUploadFailed = 6,
39 m : };
40 :
41 m : KaskoUploadApp();
42 :
43 : // @name Implementation of the AppImplBase interface.
44 : // @{
45 m : bool ParseCommandLine(const base::CommandLine* command_line);
46 m : int Run();
47 m : void TearDown() {}
48 : // @}
49 :
50 : // @name Utility functions
51 : // @{
52 m : void PrintUsage(const base::FilePath& program,
53 m : const base::StringPiece& message);
54 : // @}
55 :
56 : // Accessors.
57 : // @{
58 m : const base::FilePath& minidump_path() const { return minidump_path_; }
59 m : const base::FilePath& crash_keys_path() const { return crash_keys_path_; }
60 m : const base::string16& upload_url() const { return upload_url_; }
61 : // @}
62 :
63 : // Switches.
64 : // @{
65 m : static const char kMinidumpSwitch[];
66 m : static const char kCrashKeysSwitch[];
67 m : static const char kUploadUrlSwitch[];
68 : // @}
69 :
70 : // Default values.
71 m : static const base::char16 kDefaultUploadUrl[];
72 :
73 m : private:
74 m : base::FilePath minidump_path_;
75 m : base::FilePath crash_keys_path_;
76 m : base::string16 upload_url_;
77 :
78 m : DISALLOW_COPY_AND_ASSIGN(KaskoUploadApp);
79 m : };
80 :
81 m : } // namespace kasko
82 :
83 : #endif // SYZYGY_KASKO_KASKO_UPLOAD_APP_H_
|