| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ |
| 6 #define CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ | 6 #define CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 16 #include "content/public/browser/trace_uploader.h" | 18 #include "content/public/browser/trace_uploader.h" |
| 17 #include "net/url_request/url_fetcher_delegate.h" | 19 #include "net/url_request/url_fetcher_delegate.h" |
| 18 | 20 |
| 19 namespace net { | 21 namespace net { |
| 20 class URLFetcher; | 22 class URLFetcher; |
| 21 class URLRequestContextGetter; | 23 class URLRequestContextGetter; |
| 22 } // namespace net | 24 } // namespace net |
| 23 | 25 |
| 24 // TraceCrashServiceUploader uploads traces to the Chrome crash service. | 26 // TraceCrashServiceUploader uploads traces to the Chrome crash service. |
| 25 class TraceCrashServiceUploader : public content::TraceUploader, | 27 class TraceCrashServiceUploader : public content::TraceUploader, |
| 26 public net::URLFetcherDelegate { | 28 public net::URLFetcherDelegate { |
| 27 public: | 29 public: |
| 28 explicit TraceCrashServiceUploader( | 30 explicit TraceCrashServiceUploader( |
| 29 net::URLRequestContextGetter* request_context); | 31 net::URLRequestContextGetter* request_context); |
| 30 ~TraceCrashServiceUploader() override; | 32 ~TraceCrashServiceUploader() override; |
| 31 | 33 |
| 32 void SetUploadURL(const std::string& url); | 34 void SetUploadURL(const std::string& url); |
| 33 | 35 |
| 34 // net::URLFetcherDelegate implementation. | 36 // net::URLFetcherDelegate implementation. |
| 35 void OnURLFetchComplete(const net::URLFetcher* source) override; | 37 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 36 void OnURLFetchUploadProgress(const net::URLFetcher* source, | 38 void OnURLFetchUploadProgress(const net::URLFetcher* source, |
| 37 int64 current, | 39 int64_t current, |
| 38 int64 total) override; | 40 int64_t total) override; |
| 39 | 41 |
| 40 // content::TraceUploader | 42 // content::TraceUploader |
| 41 void DoUpload(const std::string& file_contents, | 43 void DoUpload(const std::string& file_contents, |
| 42 UploadMode upload_mode, | 44 UploadMode upload_mode, |
| 43 scoped_ptr<const base::DictionaryValue> metadata, | 45 scoped_ptr<const base::DictionaryValue> metadata, |
| 44 const UploadProgressCallback& progress_callback, | 46 const UploadProgressCallback& progress_callback, |
| 45 const UploadDoneCallback& done_callback) override; | 47 const UploadDoneCallback& done_callback) override; |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 void DoUploadOnFileThread(const std::string& file_contents, | 50 void DoUploadOnFileThread(const std::string& file_contents, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 76 UploadDoneCallback done_callback_; | 78 UploadDoneCallback done_callback_; |
| 77 | 79 |
| 78 net::URLRequestContextGetter* request_context_; | 80 net::URLRequestContextGetter* request_context_; |
| 79 | 81 |
| 80 std::string upload_url_; | 82 std::string upload_url_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(TraceCrashServiceUploader); | 84 DISALLOW_COPY_AND_ASSIGN(TraceCrashServiceUploader); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #endif // CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ | 87 #endif // CHROME_BROWSER_TRACING_CRASH_SERVICE_UPLOADER_H_ |
| OLD | NEW |