| 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/fullscreen_exit_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 9 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 10 #include "chrome/browser/ui/gtk/gtk_util.h" | 10 #include "chrome/browser/ui/gtk/gtk_util.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 gtk_widget_set_no_show_all(deny_button_, FALSE); | 100 gtk_widget_set_no_show_all(deny_button_, FALSE); |
| 101 gtk_box_pack_start(GTK_BOX(hbox_), deny_button_, FALSE, FALSE, 0); | 101 gtk_box_pack_start(GTK_BOX(hbox_), deny_button_, FALSE, FALSE, 0); |
| 102 | 102 |
| 103 link_ = gtk_chrome_link_button_new(exit_text_utf8.c_str()); | 103 link_ = gtk_chrome_link_button_new(exit_text_utf8.c_str()); |
| 104 gtk_widget_set_can_focus(link_, FALSE); | 104 gtk_widget_set_can_focus(link_, FALSE); |
| 105 gtk_widget_set_no_show_all(link_, FALSE); | 105 gtk_widget_set_no_show_all(link_, FALSE); |
| 106 gtk_chrome_link_button_set_use_gtk_theme(GTK_CHROME_LINK_BUTTON(link_), | 106 gtk_chrome_link_button_set_use_gtk_theme(GTK_CHROME_LINK_BUTTON(link_), |
| 107 FALSE); | 107 FALSE); |
| 108 gtk_box_pack_start(GTK_BOX(hbox_), link_, FALSE, FALSE, 0); | 108 gtk_box_pack_start(GTK_BOX(hbox_), link_, FALSE, FALSE, 0); |
| 109 | 109 |
| 110 instruction_label_ = gtk_label_new(UTF16ToUTF8(GetInstructionText()).c_str()); | 110 instruction_label_ = gtk_chrome_link_button_new( |
| 111 UTF16ToUTF8(GetInstructionText()).c_str()); |
| 111 gtk_widget_set_no_show_all(instruction_label_, FALSE); | 112 gtk_widget_set_no_show_all(instruction_label_, FALSE); |
| 113 gtk_chrome_link_button_set_use_gtk_theme( |
| 114 GTK_CHROME_LINK_BUTTON(instruction_label_), FALSE); |
| 112 gtk_box_pack_start(GTK_BOX(hbox_), instruction_label_, FALSE, FALSE, 0); | 115 gtk_box_pack_start(GTK_BOX(hbox_), instruction_label_, FALSE, FALSE, 0); |
| 113 | 116 |
| 114 GtkWidget* bubble = gtk_util::CreateGtkBorderBin( | 117 GtkWidget* bubble = gtk_util::CreateGtkBorderBin( |
| 115 hbox_, &ui::kGdkWhite, | 118 hbox_, &ui::kGdkWhite, |
| 116 kPaddingPx, kPaddingPx, kPaddingPx, kPaddingPx); | 119 kPaddingPx, kPaddingPx, kPaddingPx, kPaddingPx); |
| 117 gtk_util::ActAsRoundedWindow(bubble, kFrameColor, 3, | 120 gtk_util::ActAsRoundedWindow(bubble, kFrameColor, 3, |
| 118 gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL); | 121 gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL); |
| 119 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 122 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 120 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 5, 0, 0, 0); | 123 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 5, 0, 0, 0); |
| 121 gtk_container_add(GTK_CONTAINER(alignment), bubble); | 124 gtk_container_add(GTK_CONTAINER(alignment), bubble); |
| 122 ui_container_.Own(alignment); | 125 ui_container_.Own(alignment); |
| 123 | 126 |
| 124 slide_widget_.reset(new SlideAnimatorGtk(ui_container_.get(), | 127 slide_widget_.reset(new SlideAnimatorGtk(ui_container_.get(), |
| 125 SlideAnimatorGtk::DOWN, kSlideOutDurationMs, false, false, NULL)); | 128 SlideAnimatorGtk::DOWN, kSlideOutDurationMs, false, false, NULL)); |
| 126 gtk_widget_set_name(widget(), "exit-fullscreen-bubble"); | 129 gtk_widget_set_name(widget(), "exit-fullscreen-bubble"); |
| 127 gtk_widget_show_all(ui_container_.get()); | 130 gtk_widget_show_all(ui_container_.get()); |
| 128 gtk_widget_show(widget()); | 131 gtk_widget_show(widget()); |
| 129 slide_widget_->OpenWithoutAnimation(); | 132 slide_widget_->OpenWithoutAnimation(); |
| 130 | 133 |
| 131 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(container_), | 134 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(container_), |
| 132 widget()); | 135 widget()); |
| 133 | 136 |
| 134 signals_.Connect(container_, "set-floating-position", | 137 signals_.Connect(container_, "set-floating-position", |
| 135 G_CALLBACK(OnSetFloatingPositionThunk), this); | 138 G_CALLBACK(OnSetFloatingPositionThunk), this); |
| 136 signals_.Connect(link_, "clicked", G_CALLBACK(OnLinkClickedThunk), this); | 139 signals_.Connect(link_, "clicked", G_CALLBACK(OnLinkClickedThunk), this); |
| 140 signals_.Connect(instruction_label_, "clicked", |
| 141 G_CALLBACK(OnLinkClickedThunk), this); |
| 137 signals_.Connect(allow_button_, "clicked", | 142 signals_.Connect(allow_button_, "clicked", |
| 138 G_CALLBACK(&OnAllowClickedThunk), this); | 143 G_CALLBACK(&OnAllowClickedThunk), this); |
| 139 signals_.Connect(deny_button_, "clicked", | 144 signals_.Connect(deny_button_, "clicked", |
| 140 G_CALLBACK(&OnDenyClickedThunk), this); | 145 G_CALLBACK(&OnDenyClickedThunk), this); |
| 141 | 146 |
| 142 UpdateContent(url_, bubble_type_); | 147 UpdateContent(url_, bubble_type_); |
| 143 } | 148 } |
| 144 | 149 |
| 145 std::string FullscreenExitBubbleGtk::GetMessage(const GURL& url) { | 150 std::string FullscreenExitBubbleGtk::GetMessage(const GURL& url) { |
| 146 if (url.is_empty()) { | 151 if (url.is_empty()) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ToggleFullscreen(); | 238 ToggleFullscreen(); |
| 234 } | 239 } |
| 235 | 240 |
| 236 void FullscreenExitBubbleGtk::OnAllowClicked(GtkWidget* button) { | 241 void FullscreenExitBubbleGtk::OnAllowClicked(GtkWidget* button) { |
| 237 Accept(); | 242 Accept(); |
| 238 UpdateContent(url_, bubble_type_); | 243 UpdateContent(url_, bubble_type_); |
| 239 } | 244 } |
| 240 void FullscreenExitBubbleGtk::OnDenyClicked(GtkWidget* button) { | 245 void FullscreenExitBubbleGtk::OnDenyClicked(GtkWidget* button) { |
| 241 Cancel(); | 246 Cancel(); |
| 242 } | 247 } |
| OLD | NEW |