OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/instant_confirm_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/instant/instant_confirm_dialog.h" | 9 #include "chrome/browser/instant/instant_confirm_dialog.h" |
10 #include "chrome/browser/instant/instant_controller.h" | 10 #include "chrome/browser/instant/instant_controller.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
15 #include "chrome/browser/ui/gtk/gtk_util.h" | |
16 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
17 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
18 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "ui/base/gtk/gtk_hig_constants.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 | 20 |
21 namespace browser { | 21 namespace browser { |
22 | 22 |
23 void ShowInstantConfirmDialog(GtkWindow* parent, Profile* profile) { | 23 void ShowInstantConfirmDialog(GtkWindow* parent, Profile* profile) { |
24 new InstantConfirmDialogGtk(parent, profile); | 24 new InstantConfirmDialogGtk(parent, profile); |
25 } | 25 } |
26 | 26 |
27 } // namespace browser | 27 } // namespace browser |
28 | 28 |
29 InstantConfirmDialogGtk::InstantConfirmDialogGtk( | 29 InstantConfirmDialogGtk::InstantConfirmDialogGtk( |
30 GtkWindow* parent, Profile* profile) : profile_(profile) { | 30 GtkWindow* parent, Profile* profile) : profile_(profile) { |
31 dialog_ = gtk_dialog_new_with_buttons( | 31 dialog_ = gtk_dialog_new_with_buttons( |
32 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_TITLE).c_str(), | 32 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_TITLE).c_str(), |
33 parent, | 33 parent, |
34 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), | 34 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), |
35 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, | 35 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, |
36 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, | 36 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, |
37 NULL); | 37 NULL); |
38 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); | 38 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); |
39 | 39 |
40 GtkBox* vbox = GTK_BOX(GTK_DIALOG(dialog_)->vbox); | 40 GtkBox* vbox = GTK_BOX(GTK_DIALOG(dialog_)->vbox); |
41 gtk_box_set_spacing(vbox, gtk_util::kControlSpacing); | 41 gtk_box_set_spacing(vbox, ui::kControlSpacing); |
42 | 42 |
43 GtkWidget* label = gtk_label_new( | 43 GtkWidget* label = gtk_label_new( |
44 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_MESSAGE).c_str()); | 44 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_MESSAGE).c_str()); |
45 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 45 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
46 gtk_box_pack_start(vbox, label, FALSE, FALSE, 0); | 46 gtk_box_pack_start(vbox, label, FALSE, FALSE, 0); |
47 | 47 |
48 GtkWidget* link_button = gtk_chrome_link_button_new( | 48 GtkWidget* link_button = gtk_chrome_link_button_new( |
49 l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str()); | 49 l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str()); |
50 g_signal_connect(link_button, "clicked", | 50 g_signal_connect(link_button, "clicked", |
51 G_CALLBACK(OnLinkButtonClickedThunk), this); | 51 G_CALLBACK(OnLinkButtonClickedThunk), this); |
(...skipping 20 matching lines...) Expand all Loading... |
72 } | 72 } |
73 | 73 |
74 void InstantConfirmDialogGtk::OnLinkButtonClicked(GtkWidget* button) { | 74 void InstantConfirmDialogGtk::OnLinkButtonClicked(GtkWidget* button) { |
75 // We open a new browser window so the Options dialog doesn't get lost behind | 75 // We open a new browser window so the Options dialog doesn't get lost behind |
76 // other windows. | 76 // other windows. |
77 Browser* browser = Browser::Create(profile_); | 77 Browser* browser = Browser::Create(profile_); |
78 browser->AddSelectedTabWithURL(browser::InstantLearnMoreURL(), | 78 browser->AddSelectedTabWithURL(browser::InstantLearnMoreURL(), |
79 PageTransition::LINK); | 79 PageTransition::LINK); |
80 browser->window()->Show(); | 80 browser->window()->Show(); |
81 } | 81 } |
OLD | NEW |