Skip to content

Commit

Permalink
Cleanup: Remove checks for an unreachable condition.
Browse files Browse the repository at this point in the history
WebDialogDelegate::OnCloseContents() implementations will never get a
NULL |out_close_dialog| pointer.

Review URL: https://codereview.chromium.org/1078863006

Cr-Commit-Position: refs/heads/master@{#326252}
  • Loading branch information
leizleiz authored and Commit bot committed Apr 22, 2015
1 parent 46ee311 commit 809d4d7
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ void BluetoothPairingDialog::OnDialogClosed(const std::string& json_retval) {

void BluetoothPairingDialog::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool BluetoothPairingDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/login/ui/login_web_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ void LoginWebDialog::OnDialogClosed(const std::string& json_retval) {

void LoginWebDialog::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;

if (g_web_contents_stack.Pointer()->size() &&
source == g_web_contents_stack.Pointer()->front()) {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/net/network_portal_web_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ void NetworkPortalWebDialog::OnDialogClosed(const std::string& json_retval) {

void NetworkPortalWebDialog::OnCloseContents(content::WebContents* /* source */,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool NetworkPortalWebDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/set_time_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ void SetTimeDialog::OnDialogClosed(const std::string& json_retval) {

void SetTimeDialog::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool SetTimeDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/sim_dialog_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ void SimDialogDelegate::OnDialogClosed(const std::string& json_retval) {

void SimDialogDelegate::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool SimDialogDelegate::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/ui/choose_mobile_network_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void ChooseMobileNetworkDialog::OnDialogClosed(const std::string& json_retval) {

void ChooseMobileNetworkDialog::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool ChooseMobileNetworkDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/ui/inline_login_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ void InlineLoginDialog::OnDialogClosed(const std::string& json_retval) {

void InlineLoginDialog::OnCloseContents(content::WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool InlineLoginDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/printing/print_dialog_cloud.cc
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,7 @@ void CloudPrintWebDialogDelegate::OnDialogClosed(

void CloudPrintWebDialogDelegate::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool CloudPrintWebDialogDelegate::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/printing/print_preview_dialog_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ void PrintPreviewDialogDelegate::OnDialogClosed(

void PrintPreviewDialogDelegate::OnCloseContents(WebContents* /* source */,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool PrintPreviewDialogDelegate::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/cocoa/web_dialog_window_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ - (void)executeCommand:(int)command;

void WebDialogWindowDelegateBridge::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

void WebDialogWindowDelegateBridge::CloseContents(WebContents* source) {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/sync/inline_login_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void InlineLoginDialog::OnDialogClosed(const std::string& json_retval) {

void InlineLoginDialog::OnCloseContents(
content::WebContents* source, bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool InlineLoginDialog::ShouldShowDialogTitle() const {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/webui/certificate_viewer_webui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ void CertificateViewerModalDialog::OnDialogClosed(

void CertificateViewerModalDialog::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool CertificateViewerModalDialog::ShouldShowDialogTitle() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ void ProfileSigninConfirmationDialog::OnDialogClosed(
void ProfileSigninConfirmationDialog::OnCloseContents(
content::WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
*out_close_dialog = true;
}

bool ProfileSigninConfirmationDialog::ShouldShowDialogTitle() const {
Expand Down
1 change: 1 addition & 0 deletions ui/views/controls/webview/web_dialog_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ void WebDialogView::OnDialogCloseFromWebUI(const std::string& json_retval) {

void WebDialogView::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
DCHECK(out_close_dialog);
if (delegate_)
delegate_->OnCloseContents(source, out_close_dialog);
}
Expand Down
5 changes: 2 additions & 3 deletions ui/web_dialogs/test/test_web_dialog_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ void TestWebDialogDelegate::OnDialogClosed(const std::string& json_retval) {
}

void TestWebDialogDelegate::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (out_close_dialog)
*out_close_dialog = true;
bool* out_close_dialog) {
*out_close_dialog = true;
}

bool TestWebDialogDelegate::ShouldShowDialogTitle() const {
Expand Down
1 change: 1 addition & 0 deletions ui/web_dialogs/web_dialog_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class WEB_DIALOGS_EXPORT WebDialogDelegate {
// away. Only relevant if your dialog hosts code that calls
// windows.close() and you've allowed that. If the output parameter
// is set to true, then the dialog is closed. The default is false.
// |out_close_dialog| is never NULL.
virtual void OnCloseContents(content::WebContents* source,
bool* out_close_dialog) = 0;

Expand Down

0 comments on commit 809d4d7

Please sign in to comment.