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/gtk/infobars/infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 } | 121 } |
122 | 122 |
123 GtkWidget* InfoBarGtk::CreateLabel(const std::string& text) { | 123 GtkWidget* InfoBarGtk::CreateLabel(const std::string& text) { |
124 return theme_service_->BuildLabel(text, ui::kGdkBlack); | 124 return theme_service_->BuildLabel(text, ui::kGdkBlack); |
125 } | 125 } |
126 | 126 |
127 GtkWidget* InfoBarGtk::CreateLinkButton(const std::string& text) { | 127 GtkWidget* InfoBarGtk::CreateLinkButton(const std::string& text) { |
128 return theme_service_->BuildChromeLinkButton(text); | 128 return theme_service_->BuildChromeLinkButton(text); |
129 } | 129 } |
130 | 130 |
131 // static | |
132 GtkWidget* InfoBarGtk::CreateMenuButton(const std::string& text) { | |
133 // TODO(jeremy): This is a temporary solution, since media stream infobar | |
Evan Stade
2012/03/05 22:13:51
remove the comment
| |
134 // also need to create a device menu button, just copy these code from | |
135 // TranslateInfoBarBase::BuildOptionsMenuButton, remove these code when | |
136 // a gtk-theme chrome menu button is implemented. | |
137 GtkWidget* button = gtk_button_new(); | |
138 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(button)); | |
139 if (former_child) | |
140 gtk_container_remove(GTK_CONTAINER(button), former_child); | |
141 | |
142 GtkWidget* hbox = gtk_hbox_new(FALSE, 0); | |
143 | |
144 GtkWidget* label = gtk_label_new(text.c_str()); | |
145 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
146 | |
147 GtkWidget* arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); | |
148 gtk_box_pack_start(GTK_BOX(hbox), arrow, FALSE, FALSE, 0); | |
149 | |
150 gtk_container_add(GTK_CONTAINER(button), hbox); | |
151 | |
152 return button; | |
153 } | |
154 | |
131 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { | 155 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { |
132 double r, g, b; | 156 double r, g, b; |
133 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); | 157 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); |
134 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); | 158 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); |
135 } | 159 } |
136 | 160 |
137 void InfoBarGtk::AddLabelWithInlineLink(const string16& display_text, | 161 void InfoBarGtk::AddLabelWithInlineLink(const string16& display_text, |
138 const string16& link_text, | 162 const string16& link_text, |
139 size_t link_offset, | 163 size_t link_offset, |
140 GCallback callback) { | 164 GCallback callback) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 const content::NotificationSource& source, | 312 const content::NotificationSource& source, |
289 const content::NotificationDetails& details) { | 313 const content::NotificationDetails& details) { |
290 UpdateBorderColor(); | 314 UpdateBorderColor(); |
291 } | 315 } |
292 | 316 |
293 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 317 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
294 GtkWidget* child, | 318 GtkWidget* child, |
295 GtkRequisition* requisition) { | 319 GtkRequisition* requisition) { |
296 requisition->height = -1; | 320 requisition->height = -1; |
297 } | 321 } |
OLD | NEW |