Code style fixes

This commit is contained in:
Cheng Zhao 2018-03-06 11:31:56 +09:00
parent d8f16f4116
commit 7516b059fe
4 changed files with 15 additions and 16 deletions

View file

@ -17,12 +17,14 @@
using content::JavaScriptDialogType;
namespace {
constexpr int USER_WANTS_NO_MORE_DIALOGS = -1;
}
namespace atom {
namespace {
constexpr int kUserWantsNoMoreDialogs = -1;
} // namespace
AtomJavaScriptDialogManager::AtomJavaScriptDialogManager(
api::WebContents* api_web_contents)
: api_web_contents_(api_web_contents) {}
@ -36,11 +38,7 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
const DialogClosedCallback& callback,
bool* did_suppress_message) {
const std::string origin = origin_url.GetOrigin().spec();
if (origin_counts_.find(origin) == origin_counts_.end()) {
origin_counts_[origin] = 0;
}
if (origin_counts_[origin] == USER_WANTS_NO_MORE_DIALOGS) {
if (origin_counts_[origin] == kUserWantsNoMoreDialogs) {
return callback.Run(false, base::string16());
}
@ -97,7 +95,7 @@ void AtomJavaScriptDialogManager::OnMessageBoxCallback(
int code,
bool checkbox_checked) {
if (checkbox_checked) {
(*origin_counts_)[origin] = USER_WANTS_NO_MORE_DIALOGS;
(*origin_counts_)[origin] = kUserWantsNoMoreDialogs;
}
callback.Run(code == 0, base::string16());
}

View file

@ -42,6 +42,7 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
std::map<std::string, int>* origins_,
int code,
bool checkbox_checked);
api::WebContents* api_web_contents_;
std::map<std::string, int> origin_counts_;
};

View file

@ -301,13 +301,13 @@ bool WebContentsPreferences::GetInteger(const std::string& attributeName,
return false;
}
bool WebContentsPreferences::GetString(const std::string& attributeName,
std::string* stringValue,
bool WebContentsPreferences::GetString(const std::string& attribute_name,
std::string* string_value,
content::WebContents* web_contents) {
WebContentsPreferences* self = FromWebContents(web_contents);
if (!self)
return false;
return self->web_preferences()->GetString(attributeName, stringValue);
return self->web_preferences()->GetString(attribute_name, string_value);
}
} // namespace atom

View file

@ -40,9 +40,9 @@ class WebContentsPreferences
static bool IsPreferenceEnabled(const std::string& attribute_name,
content::WebContents* web_contents);
static bool GetString(const std::string& attributeName,
std::string* stringValue,
content::WebContents* web_contents);
static bool GetString(const std::string& attribute_name,
std::string* string_value,
content::WebContents* web_contents);
// Modify the WebPreferences according to |web_contents|'s preferences.
static void OverrideWebkitPrefs(