| 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 "chrome/browser/ui/views/color_chooser_dialog.h" | 5 #include "chrome/browser/ui/views/color_chooser_dialog.h" |
| 6 | 6 |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool success = !!ChooseColor(&cc); | 61 bool success = !!ChooseColor(&cc); |
| 62 DisableOwner(cc.hwndOwner); | 62 DisableOwner(cc.hwndOwner); |
| 63 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 63 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 64 base::Bind(&ColorChooserDialog::DidCloseDialog, this, success, | 64 base::Bind(&ColorChooserDialog::DidCloseDialog, this, success, |
| 65 skia::COLORREFToSkColor(cc.rgbResult), params.run_state)); | 65 skia::COLORREFToSkColor(cc.rgbResult), params.run_state)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ColorChooserDialog::DidCloseDialog(bool chose_color, | 68 void ColorChooserDialog::DidCloseDialog(bool chose_color, |
| 69 SkColor color, | 69 SkColor color, |
| 70 RunState run_state) { | 70 RunState run_state) { |
| 71 if (!listener_) | |
| 72 return; | |
| 73 EndRun(run_state); | 71 EndRun(run_state); |
| 74 CopyCustomColors(custom_colors_, g_custom_colors); | 72 CopyCustomColors(custom_colors_, g_custom_colors); |
| 75 if (chose_color) | 73 if (listener_) { |
| 76 listener_->OnColorChosen(color); | 74 if (chose_color) |
| 77 listener_->OnColorChooserDialogClosed(); | 75 listener_->OnColorChosen(color); |
| 76 listener_->OnColorChooserDialogClosed(); |
| 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ColorChooserDialog::CopyCustomColors(COLORREF* src, COLORREF* dst) { | 80 void ColorChooserDialog::CopyCustomColors(COLORREF* src, COLORREF* dst) { |
| 81 memcpy(dst, src, sizeof(COLORREF) * arraysize(g_custom_colors)); | 81 memcpy(dst, src, sizeof(COLORREF) * arraysize(g_custom_colors)); |
| 82 } | 82 } |
| OLD | NEW |