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 explicit CastCrashdumpUploader(const CastCrashdumpData& data); |
| 39 CastCrashdumpUploader(const CastCrashdumpData& data, |
| 40 google_breakpad::LibcurlWrapper* http_layer); |
| 41 ~CastCrashdumpUploader(); |
| 42 |
| 43 void Init(const CastCrashdumpData& data, |
| 44 google_breakpad::LibcurlWrapper* http_layer); |
| 45 |
| 46 bool AddAttachment(const std::string& label, const std::string& filename); |
| 47 void SetParameter(const std::string& key, const std::string& value); |
| 48 bool Upload(std::string* response); |
| 49 |
| 50 private: |
| 51 bool CheckRequiredParametersArePresent(); |
| 52 |
| 53 google_breakpad::LibcurlWrapper* http_layer_; |
| 54 bool http_layer_created_internally_; |
| 55 |
| 56 CastCrashdumpData data_; |
| 57 std::map<std::string /* label */, std::string /* file */> attachments_; |
| 58 std::map<std::string /* key */, std::string /* value */> parameters_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(CastCrashdumpUploader); |
| 61 }; |
| 62 |
| 63 } // namespace chromecast |
| 64 |
| 65 #endif // CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_ |
OLD | NEW |