| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gtk/protocol_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/protocol_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 routing_id))); | 37 routing_id))); |
| 38 } | 38 } |
| 39 | 39 |
| 40 /////////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////////// |
| 41 // ProtocolDialogGtk | 41 // ProtocolDialogGtk |
| 42 | 42 |
| 43 ProtocolDialogGtk::ProtocolDialogGtk( | 43 ProtocolDialogGtk::ProtocolDialogGtk( |
| 44 scoped_ptr<const ProtocolDialogDelegate> delegate) | 44 scoped_ptr<const ProtocolDialogDelegate> delegate) |
| 45 : delegate_(delegate.Pass()), | 45 : delegate_(delegate.Pass()), |
| 46 creation_time_(base::TimeTicks::Now()) { | 46 creation_time_(base::TimeTicks::Now()) { |
| 47 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 47 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 48 | 48 |
| 49 dialog_ = gtk_dialog_new_with_buttons( | 49 dialog_ = gtk_dialog_new_with_buttons( |
| 50 base::UTF16ToUTF8(delegate_->GetTitleText()).c_str(), | 50 base::UTF16ToUTF8(delegate_->GetTitleText()).c_str(), |
| 51 NULL, | 51 NULL, |
| 52 GTK_DIALOG_NO_SEPARATOR, | 52 GTK_DIALOG_NO_SEPARATOR, |
| 53 NULL); | 53 NULL); |
| 54 | 54 |
| 55 // Add the response buttons. | 55 // Add the response buttons. |
| 56 gtk_util::AddButtonToDialog(dialog_, | 56 gtk_util::AddButtonToDialog(dialog_, |
| 57 l10n_util::GetStringUTF8( | 57 l10n_util::GetStringUTF8( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::TimeTicks::Now() - creation_time_); | 99 base::TimeTicks::Now() - creation_time_); |
| 100 } else if (response_id == GTK_RESPONSE_REJECT) { | 100 } else if (response_id == GTK_RESPONSE_REJECT) { |
| 101 delegate_->DoCancel(delegate_->url(), checkbox); | 101 delegate_->DoCancel(delegate_->url(), checkbox); |
| 102 } | 102 } |
| 103 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing | 103 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing |
| 104 // the dialog, do nothing. | 104 // the dialog, do nothing. |
| 105 | 105 |
| 106 gtk_widget_destroy(dialog_); | 106 gtk_widget_destroy(dialog_); |
| 107 delete this; | 107 delete this; |
| 108 } | 108 } |
| OLD | NEW |