OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/window/dialog_client_view.h" | 5 #include "views/window/dialog_client_view.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
10 #include <vsstyle.h> | 10 #include <vsstyle.h> |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // TODO(port): add accelerators | 362 // TODO(port): add accelerators |
363 #endif | 363 #endif |
364 Close(); | 364 Close(); |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 //////////////////////////////////////////////////////////////////////////////// | 368 //////////////////////////////////////////////////////////////////////////////// |
369 // DialogClientView, ButtonListener implementation: | 369 // DialogClientView, ButtonListener implementation: |
370 | 370 |
371 void DialogClientView::ButtonPressed(Button* sender) { | 371 void DialogClientView::ButtonPressed(Button* sender) { |
| 372 // We NULL check the delegate here since the buttons can receive WM_COMMAND |
| 373 // messages even after they (and the window containing us) are destroyed. |
| 374 if (!GetDialogDelegate()) |
| 375 return; |
| 376 |
372 if (sender == ok_button_) { | 377 if (sender == ok_button_) { |
373 AcceptWindow(); | 378 AcceptWindow(); |
374 } else if (sender == cancel_button_) { | 379 } else if (sender == cancel_button_) { |
375 CancelWindow(); | 380 CancelWindow(); |
376 } else { | 381 } else { |
377 NOTREACHED(); | 382 NOTREACHED(); |
378 } | 383 } |
379 } | 384 } |
380 | 385 |
381 //////////////////////////////////////////////////////////////////////////////// | 386 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 initialized = true; | 502 initialized = true; |
498 } | 503 } |
499 } | 504 } |
500 | 505 |
501 void DialogClientView::Close() { | 506 void DialogClientView::Close() { |
502 window()->Close(); | 507 window()->Close(); |
503 GetDialogDelegate()->OnClose(); | 508 GetDialogDelegate()->OnClose(); |
504 } | 509 } |
505 | 510 |
506 } // namespace views | 511 } // namespace views |
OLD | NEW |