Use GetUploadsEnabled to return GetShouldUpload

This commit is contained in:
Samuel Attard 2016-11-08 13:39:11 +13:00 committed by Kevin Sawicki
parent 5a1a2616aa
commit 285a36f9de
7 changed files with 31 additions and 7 deletions

View file

@ -42,6 +42,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
base::Bind(&CrashReporter::GetUploadedReports, report));
dict.SetMethod("_setShouldUpload",
base::Bind(&CrashReporter::SetShouldUpload, report));
dict.SetMethod("_getShouldUpload",
base::Bind(&CrashReporter::GetShouldUpload, report));
}
} // namespace

View file

@ -47,6 +47,10 @@ void CrashReporter::SetShouldUpload(const bool should_upload) {
}
bool CrashReporter::GetShouldUpload() {
return true;
}
std::vector<CrashReporter::UploadReportResult>
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
std::string file_content;

View file

@ -34,6 +34,7 @@ class CrashReporter {
const base::FilePath& crashes_dir);
virtual void SetShouldUpload(bool should_upload);
virtual bool GetShouldUpload();
protected:
CrashReporter();

View file

@ -33,6 +33,7 @@ class CrashReporterMac : public CrashReporter {
bool skip_system_crash_handler) override;
void SetUploadParameters() override;
void SetShouldUpload(bool should_upload) override;
bool GetShouldUpload() override;
private:
friend struct base::DefaultSingletonTraits<CrashReporterMac>;

View file

@ -75,12 +75,18 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
if (is_browser_) {
database_ =
crashpad::CrashReportDatabase::Initialize(crashes_dir);
if (database_) {
database_->GetSettings()->SetUploadsEnabled(should_upload);
}
SetShouldUpload(should_upload);
}
}
bool CrashReporterMac::GetShouldUpload() {
bool enabled = true;
if (database_) {
database_->GetSettings()->GetUploadsEnabled(&enabled);
}
return enabled;
}
void CrashReporterMac::SetShouldUpload(const bool should_upload) {
if (database_) {
database_->GetSettings()->SetUploadsEnabled(should_upload);