diff --git a/atom/common/api/atom_api_crash_reporter.cc b/atom/common/api/atom_api_crash_reporter.cc index fb9ad3bb54c5..aaaf200b32f3 100644 --- a/atom/common/api/atom_api_crash_reporter.cc +++ b/atom/common/api/atom_api_crash_reporter.cc @@ -40,10 +40,10 @@ void Initialize(v8::Local exports, v8::Local unused, base::Bind(&CrashReporter::Start, report)); dict.SetMethod("_getUploadedReports", base::Bind(&CrashReporter::GetUploadedReports, report)); - dict.SetMethod("_setShouldUpload", - base::Bind(&CrashReporter::SetShouldUpload, report)); - dict.SetMethod("_getShouldUpload", - base::Bind(&CrashReporter::GetShouldUpload, report)); + dict.SetMethod("_setUploadToServer", + base::Bind(&CrashReporter::SetUploadToServer, report)); + dict.SetMethod("_getUploadToServer", + base::Bind(&CrashReporter::GetUploadToServer, report)); } } // namespace diff --git a/atom/common/crash_reporter/crash_reporter.cc b/atom/common/crash_reporter/crash_reporter.cc index 7f0834941e7e..5e13bd6fe5b0 100644 --- a/atom/common/crash_reporter/crash_reporter.cc +++ b/atom/common/crash_reporter/crash_reporter.cc @@ -26,13 +26,13 @@ void CrashReporter::Start(const std::string& product_name, const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler, const StringMap& extra_parameters) { SetUploadParameters(extra_parameters); InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url, - crashes_dir, should_upload, skip_system_crash_handler); + crashes_dir, upload_to_server, skip_system_crash_handler); } void CrashReporter::SetUploadParameters(const StringMap& parameters) { @@ -43,10 +43,10 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) { SetUploadParameters(); } -void CrashReporter::SetShouldUpload(const bool should_upload) { +void CrashReporter::SetUploadToServer(const bool upload_to_server) { } -bool CrashReporter::GetShouldUpload() { +bool CrashReporter::GetUploadToServer() { return true; } diff --git a/atom/common/crash_reporter/crash_reporter.h b/atom/common/crash_reporter/crash_reporter.h index fe7d109460b1..6eb43d0a2dfe 100644 --- a/atom/common/crash_reporter/crash_reporter.h +++ b/atom/common/crash_reporter/crash_reporter.h @@ -26,15 +26,15 @@ class CrashReporter { const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler, const StringMap& extra_parameters); virtual std::vector GetUploadedReports( const base::FilePath& crashes_dir); - virtual void SetShouldUpload(bool should_upload); - virtual bool GetShouldUpload(); + virtual void SetUploadToServer(bool upload_to_server); + virtual bool GetUploadToServer(); protected: CrashReporter(); @@ -45,7 +45,7 @@ class CrashReporter { const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler); virtual void SetUploadParameters(); diff --git a/atom/common/crash_reporter/crash_reporter_linux.cc b/atom/common/crash_reporter/crash_reporter_linux.cc index 5299997a6f45..50e1c5ec862c 100644 --- a/atom/common/crash_reporter/crash_reporter_linux.cc +++ b/atom/common/crash_reporter/crash_reporter_linux.cc @@ -60,7 +60,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name, const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) { EnableCrashDumping(crashes_dir); diff --git a/atom/common/crash_reporter/crash_reporter_linux.h b/atom/common/crash_reporter/crash_reporter_linux.h index 8be6e5f67c28..846e1f1b0a91 100644 --- a/atom/common/crash_reporter/crash_reporter_linux.h +++ b/atom/common/crash_reporter/crash_reporter_linux.h @@ -32,7 +32,7 @@ class CrashReporterLinux : public CrashReporter { const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) override; void SetUploadParameters() override; diff --git a/atom/common/crash_reporter/crash_reporter_mac.h b/atom/common/crash_reporter/crash_reporter_mac.h index d9b0ca734473..9066f2017bb2 100644 --- a/atom/common/crash_reporter/crash_reporter_mac.h +++ b/atom/common/crash_reporter/crash_reporter_mac.h @@ -29,11 +29,11 @@ class CrashReporterMac : public CrashReporter { const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) override; void SetUploadParameters() override; - void SetShouldUpload(bool should_upload) override; - bool GetShouldUpload() override; + void SetUploadToServer(bool upload_to_server) override; + bool GetUploadToServer() override; private: friend struct base::DefaultSingletonTraits; diff --git a/atom/common/crash_reporter/crash_reporter_mac.mm b/atom/common/crash_reporter/crash_reporter_mac.mm index 9c649a21a14c..877c68d1c2b6 100644 --- a/atom/common/crash_reporter/crash_reporter_mac.mm +++ b/atom/common/crash_reporter/crash_reporter_mac.mm @@ -31,7 +31,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name, const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) { // check whether crashpad has been initialized. // Only need to initialize once. @@ -75,11 +75,11 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name, if (is_browser_) { database_ = crashpad::CrashReportDatabase::Initialize(crashes_dir); - SetShouldUpload(should_upload); + SetUploadToServer(upload_to_server); } } -bool CrashReporterMac::GetShouldUpload() { +bool CrashReporterMac::GetUploadToServer() { bool enabled = true; if (database_) { database_->GetSettings()->GetUploadsEnabled(&enabled); @@ -87,9 +87,9 @@ bool CrashReporterMac::GetShouldUpload() { return enabled; } -void CrashReporterMac::SetShouldUpload(const bool should_upload) { +void CrashReporterMac::SetUploadToServer(const bool upload_to_server) { if (database_) { - database_->GetSettings()->SetUploadsEnabled(should_upload); + database_->GetSettings()->SetUploadsEnabled(upload_to_server); } } diff --git a/atom/common/crash_reporter/crash_reporter_win.cc b/atom/common/crash_reporter/crash_reporter_win.cc index d78f35cbb5d3..25969dc32eb3 100644 --- a/atom/common/crash_reporter/crash_reporter_win.cc +++ b/atom/common/crash_reporter/crash_reporter_win.cc @@ -150,7 +150,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name, const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) { skip_system_crash_handler_ = skip_system_crash_handler; diff --git a/atom/common/crash_reporter/crash_reporter_win.h b/atom/common/crash_reporter/crash_reporter_win.h index 6cac00225d96..3fc139aca190 100644 --- a/atom/common/crash_reporter/crash_reporter_win.h +++ b/atom/common/crash_reporter/crash_reporter_win.h @@ -28,7 +28,7 @@ class CrashReporterWin : public CrashReporter { const std::string& company_name, const std::string& submit_url, const base::FilePath& crashes_dir, - bool should_upload, + bool upload_to_server, bool skip_system_crash_handler) override; void SetUploadParameters() override; diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 216a36a53b16..044e6a8fdcc2 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -40,7 +40,7 @@ The `crashReporter` module has the following methods: * `companyName` String (optional) * `submitURL` String - URL that crash reports will be sent to as POST. * `productName` String (optional) - Defaults to `app.getName()`. - * `shouldUpload` Boolean (optional) _macOS_ - Whether crash reports should be sent to the server + * `uploadToServer` Boolean (optional) _macOS_ - Whether crash reports should be sent to the server Default is `true`. * `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`. * `extra` Object (optional) - An object you can define that will be sent along with the @@ -70,16 +70,16 @@ Returns [`CrashReport[]`](structures/crash-report.md): Returns all uploaded crash reports. Each report contains the date and uploaded ID. -### `crashReporter.getShouldUpload()` _macOS_ +### `crashReporter.getUploadToServer()` _macOS_ Returns `Boolean` - Whether reports should be submitted to the server. Set through -the `start` method or `setShouldUpload`. +the `start` method or `setUploadToServer`. **NOTE:** This API can only be used from the main process -### `crashReporter.setShouldUpload(shouldUpload)` _macOS_ +### `crashReporter.setUploadToServer(uploadToServer)` _macOS_ -* `shouldUpload` Boolean _macOS_ - Whether reports should be submitted to the server +* `uploadToServer` Boolean _macOS_ - Whether reports should be submitted to the server This would normally be controlled by user preferences. diff --git a/lib/common/api/crash-reporter.js b/lib/common/api/crash-reporter.js index 4b49292b917e..a9509e4ed310 100644 --- a/lib/common/api/crash-reporter.js +++ b/lib/common/api/crash-reporter.js @@ -13,16 +13,16 @@ class CrashReporter { options = {} } this.productName = options.productName != null ? options.productName : app.getName() - let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL, shouldUpload} = options + let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL, uploadToServer} = options - if (autoSubmit == null && shouldUpload == null) { - shouldUpload = true + if (autoSubmit == null && uploadToServer == null) { + uploadToServer = true } else { if (typeof autoSubmit !== 'undefined') { // TODO: Remove depreceated property in 2.0.0 - console.warn('The "autoSubmit" attribute on electron.crashReporter.start is depreceated. Please use "shouldUpload" instead.') + console.warn('The "autoSubmit" attribute on electron.crashReporter.start is depreceated. Please use "uploadToServer" instead.') } - shouldUpload = shouldUpload || autoSubmit + uploadToServer = uploadToServer || autoSubmit } if (ignoreSystemCrashHandler == null) { ignoreSystemCrashHandler = false @@ -62,7 +62,7 @@ class CrashReporter { }) } - binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), shouldUpload, ignoreSystemCrashHandler, extra) + binding.start(this.getProductName(), companyName, submitURL, this.getCrashesDirectory(), uploadToServer, ignoreSystemCrashHandler, extra) } getLastCrashReport () { @@ -102,19 +102,19 @@ class CrashReporter { return this.tempDirectory } - getShouldUpload () { + getUploadToServer () { if (process.type === 'browser') { - return binding._getShouldUpload() + return binding._getUploadToServer() } else { - throw new Error('getShouldUpload can only be called from the main process') + throw new Error('getUploadToServer can only be called from the main process') } } - setShouldUpload (shouldUpload) { + setUploadToServer (uploadToServer) { if (process.type === 'browser') { - return binding._setShouldUpload(shouldUpload) + return binding._setUploadToServer(uploadToServer) } else { - throw new Error('setShouldUpload can only be called from the main process') + throw new Error('setUploadToServer can only be called from the main process') } } }