| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/window/dialog_client_view.h" | 5 #include "ui/views/window/dialog_client_view.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 /////////////////////////////////////////////////////////////////////////////// | 252 /////////////////////////////////////////////////////////////////////////////// |
| 253 // DialogClientView, ClientView overrides: | 253 // DialogClientView, ClientView overrides: |
| 254 | 254 |
| 255 bool DialogClientView::CanClose() { | 255 bool DialogClientView::CanClose() { |
| 256 if (notified_delegate_) | 256 if (notified_delegate_) |
| 257 return true; | 257 return true; |
| 258 | 258 |
| 259 DialogDelegate* dd = GetDialogDelegate(); | 259 DialogDelegate* dd = GetDialogDelegate(); |
| 260 int buttons = dd->GetDialogButtons(); | 260 int buttons = dd->GetDialogButtons(); |
| 261 bool close = true; | 261 bool close = true; |
| 262 if (buttons & ui::DIALOG_BUTTON_CANCEL) | 262 if ((buttons & ui::DIALOG_BUTTON_CANCEL) || |
| 263 (buttons == ui::DIALOG_BUTTON_NONE)) |
| 263 close = dd->Cancel(); | 264 close = dd->Cancel(); |
| 264 else if (buttons & ui::DIALOG_BUTTON_OK) | 265 else if (buttons & ui::DIALOG_BUTTON_OK) |
| 265 close = dd->Accept(true); | 266 close = dd->Accept(true); |
| 266 notified_delegate_ = close; | 267 notified_delegate_ = close; |
| 267 return close; | 268 return close; |
| 268 } | 269 } |
| 269 | 270 |
| 270 void DialogClientView::WidgetClosing() { | 271 void DialogClientView::WidgetClosing() { |
| 271 if (listening_to_focus_) { | 272 if (listening_to_focus_) { |
| 272 DCHECK(saved_focus_manager_); | 273 DCHECK(saved_focus_manager_); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 523 } |
| 523 saved_focus_manager_ = focus_manager; | 524 saved_focus_manager_ = focus_manager; |
| 524 // Listen for focus change events so we can update the default button. | 525 // Listen for focus change events so we can update the default button. |
| 525 if (focus_manager) { | 526 if (focus_manager) { |
| 526 focus_manager->AddFocusChangeListener(this); | 527 focus_manager->AddFocusChangeListener(this); |
| 527 listening_to_focus_ = true; | 528 listening_to_focus_ = true; |
| 528 } | 529 } |
| 529 } | 530 } |
| 530 | 531 |
| 531 } // namespace views | 532 } // namespace views |
| OLD | NEW |