Use GetUploadsEnabled to return GetShouldUpload
This commit is contained in:
parent
5a1a2616aa
commit
285a36f9de
7 changed files with 31 additions and 7 deletions
|
@ -42,6 +42,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||||
base::Bind(&CrashReporter::GetUploadedReports, report));
|
base::Bind(&CrashReporter::GetUploadedReports, report));
|
||||||
dict.SetMethod("_setShouldUpload",
|
dict.SetMethod("_setShouldUpload",
|
||||||
base::Bind(&CrashReporter::SetShouldUpload, report));
|
base::Bind(&CrashReporter::SetShouldUpload, report));
|
||||||
|
dict.SetMethod("_getShouldUpload",
|
||||||
|
base::Bind(&CrashReporter::GetShouldUpload, report));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -47,6 +47,10 @@ void CrashReporter::SetShouldUpload(const bool should_upload) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CrashReporter::GetShouldUpload() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CrashReporter::UploadReportResult>
|
std::vector<CrashReporter::UploadReportResult>
|
||||||
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
|
CrashReporter::GetUploadedReports(const base::FilePath& crashes_dir) {
|
||||||
std::string file_content;
|
std::string file_content;
|
||||||
|
|
|
@ -34,6 +34,7 @@ class CrashReporter {
|
||||||
const base::FilePath& crashes_dir);
|
const base::FilePath& crashes_dir);
|
||||||
|
|
||||||
virtual void SetShouldUpload(bool should_upload);
|
virtual void SetShouldUpload(bool should_upload);
|
||||||
|
virtual bool GetShouldUpload();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CrashReporter();
|
CrashReporter();
|
||||||
|
|
|
@ -33,6 +33,7 @@ class CrashReporterMac : public CrashReporter {
|
||||||
bool skip_system_crash_handler) override;
|
bool skip_system_crash_handler) override;
|
||||||
void SetUploadParameters() override;
|
void SetUploadParameters() override;
|
||||||
void SetShouldUpload(bool should_upload) override;
|
void SetShouldUpload(bool should_upload) override;
|
||||||
|
bool GetShouldUpload() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
|
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
|
||||||
|
|
|
@ -75,12 +75,18 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
|
||||||
if (is_browser_) {
|
if (is_browser_) {
|
||||||
database_ =
|
database_ =
|
||||||
crashpad::CrashReportDatabase::Initialize(crashes_dir);
|
crashpad::CrashReportDatabase::Initialize(crashes_dir);
|
||||||
if (database_) {
|
SetShouldUpload(should_upload);
|
||||||
database_->GetSettings()->SetUploadsEnabled(should_upload);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CrashReporterMac::GetShouldUpload() {
|
||||||
|
bool enabled = true;
|
||||||
|
if (database_) {
|
||||||
|
database_->GetSettings()->GetUploadsEnabled(&enabled);
|
||||||
|
}
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void CrashReporterMac::SetShouldUpload(const bool should_upload) {
|
void CrashReporterMac::SetShouldUpload(const bool should_upload) {
|
||||||
if (database_) {
|
if (database_) {
|
||||||
database_->GetSettings()->SetUploadsEnabled(should_upload);
|
database_->GetSettings()->SetUploadsEnabled(should_upload);
|
||||||
|
|
|
@ -75,12 +75,16 @@ ID.
|
||||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||||
the `start` method or `setShouldUpload`.
|
the `start` method or `setShouldUpload`.
|
||||||
|
|
||||||
|
**NOTE:** This API can only be used from the main process
|
||||||
|
|
||||||
### `crashReporter.setShouldUpload(shouldUpload)` _macOS_
|
### `crashReporter.setShouldUpload(shouldUpload)` _macOS_
|
||||||
|
|
||||||
* `shouldUpload` Boolean _macOS_ - Whether reports should be submitted to the server
|
* `shouldUpload` Boolean _macOS_ - Whether reports should be submitted to the server
|
||||||
|
|
||||||
This would normally be controlled by user preferences.
|
This would normally be controlled by user preferences.
|
||||||
|
|
||||||
|
**NOTE:** This API can only be used from the main process
|
||||||
|
|
||||||
## Crash Report Payload
|
## Crash Report Payload
|
||||||
|
|
||||||
The crash reporter will send the following data to the `submitURL` as
|
The crash reporter will send the following data to the `submitURL` as
|
||||||
|
|
|
@ -62,7 +62,6 @@ class CrashReporter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this._shouldUpload = shouldUpload
|
|
||||||
binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), shouldUpload, ignoreSystemCrashHandler, extra)
|
binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), shouldUpload, ignoreSystemCrashHandler, extra)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,12 +103,19 @@ class CrashReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
getShouldUpload() {
|
getShouldUpload() {
|
||||||
return this._shouldUpload
|
if (process.type === 'browser') {
|
||||||
|
return binding._getShouldUpload()
|
||||||
|
} else {
|
||||||
|
throw new Error('getShouldUpload can only be called from the main process')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setShouldUpload(shouldUpload) {
|
setShouldUpload(shouldUpload) {
|
||||||
this._shouldUpload = shouldUpload
|
if (process.type === 'browser') {
|
||||||
return binding._setShouldUpload(shouldUpload)
|
return binding._setShouldUpload(shouldUpload)
|
||||||
|
} else {
|
||||||
|
throw new Error('setShouldUpload can only be called from the main process')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue