Use USER_WANTS_NO_MORE_DIALOGS constant for -1 magic number

This commit is contained in:
Samuel Attard 2018-02-15 13:07:49 +11:00 committed by Cheng Zhao
parent a5a068b2ee
commit 731240e0e9

View file

@ -17,6 +17,10 @@
using content::JavaScriptDialogType;
namespace {
constexpr int USER_WANTS_NO_MORE_DIALOGS = -1;
}
namespace atom {
AtomJavaScriptDialogManager::AtomJavaScriptDialogManager(
@ -36,7 +40,7 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
origin_counts_[origin] = 0;
}
if (origin_counts_[origin] == -1) {
if (origin_counts_[origin] == USER_WANTS_NO_MORE_DIALOGS) {
return callback.Run(false, base::string16());
}
@ -92,7 +96,7 @@ void AtomJavaScriptDialogManager::OnMessageBoxCallback(
int code,
bool checkbox_checked) {
if (checkbox_checked) {
(*origin_counts_)[origin] = -1;
(*origin_counts_)[origin] = USER_WANTS_NO_MORE_DIALOGS;
}
callback.Run(code == 0, base::string16());
}