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 24 matching lines...) Expand all Loading... |
35 new ExternalProtocolDialogDelegate(url))); | 35 new ExternalProtocolDialogDelegate(url))); |
36 } | 36 } |
37 | 37 |
38 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
39 // ProtocolDialogGtk | 39 // ProtocolDialogGtk |
40 | 40 |
41 ProtocolDialogGtk::ProtocolDialogGtk( | 41 ProtocolDialogGtk::ProtocolDialogGtk( |
42 scoped_ptr<const ProtocolDialogDelegate> delegate) | 42 scoped_ptr<const ProtocolDialogDelegate> delegate) |
43 : delegate_(delegate.Pass()), | 43 : delegate_(delegate.Pass()), |
44 creation_time_(base::TimeTicks::Now()) { | 44 creation_time_(base::TimeTicks::Now()) { |
45 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 45 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
46 | 46 |
47 dialog_ = gtk_dialog_new_with_buttons( | 47 dialog_ = gtk_dialog_new_with_buttons( |
48 UTF16ToUTF8(delegate_->GetTitleText()).c_str(), | 48 UTF16ToUTF8(delegate_->GetTitleText()).c_str(), |
49 NULL, | 49 NULL, |
50 GTK_DIALOG_NO_SEPARATOR, | 50 GTK_DIALOG_NO_SEPARATOR, |
51 NULL); | 51 NULL); |
52 | 52 |
53 // Add the response buttons. | 53 // Add the response buttons. |
54 gtk_util::AddButtonToDialog(dialog_, | 54 gtk_util::AddButtonToDialog(dialog_, |
55 l10n_util::GetStringUTF8( | 55 l10n_util::GetStringUTF8( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 base::TimeTicks::Now() - creation_time_); | 97 base::TimeTicks::Now() - creation_time_); |
98 } else if (response_id == GTK_RESPONSE_REJECT) { | 98 } else if (response_id == GTK_RESPONSE_REJECT) { |
99 delegate_->DoCancel(delegate_->url(), checkbox); | 99 delegate_->DoCancel(delegate_->url(), checkbox); |
100 } | 100 } |
101 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing | 101 // If the response is GTK_RESPONSE_DELETE, triggered by the user closing |
102 // the dialog, do nothing. | 102 // the dialog, do nothing. |
103 | 103 |
104 gtk_widget_destroy(dialog_); | 104 gtk_widget_destroy(dialog_); |
105 delete this; | 105 delete this; |
106 } | 106 } |
OLD | NEW |