Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/ui/gtk/infobars/infobar_gtk.cc

Issue 9602007: GTK: Move TranslateInfoBarBase::BuildOptionsMenuButton to InfoBarGtk::CreateMenuButton (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Evan's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 GtkWidget* button = gtk_button_new();
134 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(button));
135 if (former_child)
136 gtk_container_remove(GTK_CONTAINER(button), former_child);
137
138 GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
139
140 GtkWidget* label = gtk_label_new(text.c_str());
141 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
142
143 GtkWidget* arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
144 gtk_box_pack_start(GTK_BOX(hbox), arrow, FALSE, FALSE, 0);
145
146 gtk_container_add(GTK_CONTAINER(button), hbox);
147
148 return button;
149 }
150
131 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { 151 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) {
132 double r, g, b; 152 double r, g, b;
133 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); 153 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b);
134 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); 154 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b);
135 } 155 }
136 156
137 void InfoBarGtk::AddLabelWithInlineLink(const string16& display_text, 157 void InfoBarGtk::AddLabelWithInlineLink(const string16& display_text,
138 const string16& link_text, 158 const string16& link_text,
139 size_t link_offset, 159 size_t link_offset,
140 GCallback callback) { 160 GCallback callback) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 const content::NotificationSource& source, 308 const content::NotificationSource& source,
289 const content::NotificationDetails& details) { 309 const content::NotificationDetails& details) {
290 UpdateBorderColor(); 310 UpdateBorderColor();
291 } 311 }
292 312
293 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, 313 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded,
294 GtkWidget* child, 314 GtkWidget* child,
295 GtkRequisition* requisition) { 315 GtkRequisition* requisition) {
296 requisition->height = -1; 316 requisition->height = -1;
297 } 317 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_gtk.h ('k') | chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698