Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / chromecast / crash / cast_crashdump_uploader.h
blobacdfd9ad3b3bfab3d728a6fb27764c2e583fdd1e
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.
5 #ifndef CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_
6 #define CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_
8 #include <map>
9 #include <string>
11 #include "base/macros.h"
13 namespace google_breakpad {
14 class LibcurlWrapper;
17 namespace chromecast {
19 struct CastCrashdumpData {
20 CastCrashdumpData();
21 ~CastCrashdumpData();
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;
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();
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);
48 private:
49 bool CheckRequiredParametersArePresent();
51 google_breakpad::LibcurlWrapper* http_layer_;
52 CastCrashdumpData data_;
54 // Holds the following mapping for attachments: <label, filepath>
55 std::map<std::string, std::string> attachments_;
57 // Holds the following mapping for HTTP request params: <key, value>
58 std::map<std::string, std::string> parameters_;
60 DISALLOW_COPY_AND_ASSIGN(CastCrashdumpUploader);
63 } // namespace chromecast
65 #endif // CHROMECAST_CRASH_CAST_CRASHDUMP_UPLOADER_H_