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 CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_ |
| 6 #define CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 |
| 13 namespace google_breakpad { |
| 14 class LibcurlWrapper; |
| 15 } |
| 16 |
| 17 namespace chromecast { |
| 18 |
| 19 struct CastCrashdumpData { |
| 20 CastCrashdumpData(); |
| 21 ~CastCrashdumpData(); |
| 22 |
| 23 std::string product; |
| 24 std::string version; |
| 25 std::string guid; |
| 26 std::string ptime; |
| 27 std::string ctime; |
| 28 std::string email; |
| 29 std::string comments; |
| 30 std::string minidump_pathname; |
| 31 std::string crash_server; |
| 32 std::string proxy_host; |
| 33 std::string proxy_userpassword; |
| 34 }; |
| 35 |
| 36 class CastCrashdumpUploader { |
| 37 public: |
| 38 // Does not take ownership of |http_layer|. |
| 39 CastCrashdumpUploader(const CastCrashdumpData& data, |
| 40 google_breakpad::LibcurlWrapper* http_layer); |
| 41 CastCrashdumpUploader(const CastCrashdumpData& data); |
| 42 ~CastCrashdumpUploader(); |
| 43 |
| 44 bool AddAttachment(const std::string& label, const std::string& filename); |
| 45 void SetParameter(const std::string& key, const std::string& value); |
| 46 bool Upload(std::string* response); |
| 47 |
| 48 private: |
| 49 bool CheckRequiredParametersArePresent(); |
| 50 |
| 51 google_breakpad::LibcurlWrapper* http_layer_; |
| 52 CastCrashdumpData data_; |
| 53 |
| 54 // Holds the following mapping for attachments: <label, filepath> |
| 55 std::map<std::string, std::string> attachments_; |
| 56 |
| 57 // Holds the following mapping for HTTP request params: <key, value> |
| 58 std::map<std::string, std::string> parameters_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(CastCrashdumpUploader); |
| 61 }; |
| 62 |
| 63 } // namespace chromecast |
| 64 |
| 65 #endif // CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_ |
OLD | NEW |