OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 tab_to_search_full_label_ = gtk_label_new(NULL); | 202 tab_to_search_full_label_ = gtk_label_new(NULL); |
203 tab_to_search_partial_label_ = gtk_label_new(NULL); | 203 tab_to_search_partial_label_ = gtk_label_new(NULL); |
204 GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); | 204 GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); |
205 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), | 205 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), |
206 tab_to_search_full_label_, FALSE, FALSE, 0); | 206 tab_to_search_full_label_, FALSE, FALSE, 0); |
207 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), | 207 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), |
208 tab_to_search_partial_label_, FALSE, FALSE, 0); | 208 tab_to_search_partial_label_, FALSE, FALSE, 0); |
209 GtkWidget* tab_to_search_hbox = gtk_hbox_new(FALSE, 0); | 209 GtkWidget* tab_to_search_hbox = gtk_hbox_new(FALSE, 0); |
210 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 210 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
211 tab_to_search_magnifier_ = gtk_image_new_from_pixbuf( | 211 tab_to_search_magnifier_ = gtk_image_new_from_pixbuf( |
212 rb.GetPixbufNamed(IDR_OMNIBOX_SEARCH)); | 212 rb.GetPixbufNamed(IDR_KEYWORD_SEARCH_MAGNIFIER)); |
213 gtk_box_pack_start(GTK_BOX(tab_to_search_hbox), tab_to_search_magnifier_, | 213 gtk_box_pack_start(GTK_BOX(tab_to_search_hbox), tab_to_search_magnifier_, |
214 FALSE, FALSE, 0); | 214 FALSE, FALSE, 0); |
215 gtk_util::CenterWidgetInHBox(tab_to_search_hbox, tab_to_search_label_hbox, | 215 gtk_util::CenterWidgetInHBox(tab_to_search_hbox, tab_to_search_label_hbox, |
216 false, 0); | 216 false, 0); |
217 | 217 |
218 // This creates a box around the keyword text with a border, background color, | 218 // This creates a box around the keyword text with a border, background color, |
219 // and padding around the text. | 219 // and padding around the text. |
220 tab_to_search_box_ = gtk_util::CreateGtkBorderBin( | 220 tab_to_search_box_ = gtk_util::CreateGtkBorderBin( |
221 tab_to_search_hbox, NULL, 1, 1, 1, 3); | 221 tab_to_search_hbox, NULL, 1, 1, 1, 3); |
222 gtk_widget_set_name(tab_to_search_box_, "chrome-tab-to-search-box"); | 222 gtk_widget_set_name(tab_to_search_box_, "chrome-tab-to-search-box"); |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 starred_ = starred; | 1055 starred_ = starred; |
1056 UpdateStarIcon(); | 1056 UpdateStarIcon(); |
1057 } | 1057 } |
1058 | 1058 |
1059 void LocationBarViewGtk::UpdateStarIcon() { | 1059 void LocationBarViewGtk::UpdateStarIcon() { |
1060 if (!star_.get()) | 1060 if (!star_.get()) |
1061 return; | 1061 return; |
1062 | 1062 |
1063 gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), | 1063 gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), |
1064 theme_provider_->GetPixbufNamed( | 1064 theme_provider_->GetPixbufNamed( |
1065 starred_ ? IDR_OMNIBOX_STAR_LIT : IDR_OMNIBOX_STAR)); | 1065 starred_ ? IDR_STAR_LIT : IDR_STAR)); |
1066 } | 1066 } |
1067 | 1067 |
1068 bool LocationBarViewGtk::ShouldOnlyShowLocation() { | 1068 bool LocationBarViewGtk::ShouldOnlyShowLocation() { |
1069 return browser_->type() != Browser::TYPE_NORMAL; | 1069 return browser_->type() != Browser::TYPE_NORMAL; |
1070 } | 1070 } |
1071 | 1071 |
1072 void LocationBarViewGtk::AdjustChildrenVisibility() { | 1072 void LocationBarViewGtk::AdjustChildrenVisibility() { |
1073 int text_width = location_entry_->TextWidth(); | 1073 int text_width = location_entry_->TextWidth(); |
1074 int available_width = entry_box_width_ - text_width - kInnerPadding; | 1074 int available_width = entry_box_width_ - text_width - kInnerPadding; |
1075 | 1075 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 | 1421 |
1422 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1422 std::string badge_text = page_action_->GetBadgeText(tab_id); |
1423 if (badge_text.empty()) | 1423 if (badge_text.empty()) |
1424 return FALSE; | 1424 return FALSE; |
1425 | 1425 |
1426 gfx::CanvasSkiaPaint canvas(event, false); | 1426 gfx::CanvasSkiaPaint canvas(event, false); |
1427 gfx::Rect bounding_rect(widget->allocation); | 1427 gfx::Rect bounding_rect(widget->allocation); |
1428 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1428 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
1429 return FALSE; | 1429 return FALSE; |
1430 } | 1430 } |
OLD | NEW |