| 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/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 tab_to_search_partial_label_ = | 234 tab_to_search_partial_label_ = |
| 235 theme_service_->BuildLabel("", ui::kGdkBlack); | 235 theme_service_->BuildLabel("", ui::kGdkBlack); |
| 236 GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); | 236 GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); |
| 237 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), | 237 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), |
| 238 tab_to_search_full_label_, FALSE, FALSE, 0); | 238 tab_to_search_full_label_, FALSE, FALSE, 0); |
| 239 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), | 239 gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), |
| 240 tab_to_search_partial_label_, FALSE, FALSE, 0); | 240 tab_to_search_partial_label_, FALSE, FALSE, 0); |
| 241 GtkWidget* tab_to_search_hbox = gtk_hbox_new(FALSE, 0); | 241 GtkWidget* tab_to_search_hbox = gtk_hbox_new(FALSE, 0); |
| 242 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 242 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 243 tab_to_search_magnifier_ = gtk_image_new_from_pixbuf( | 243 tab_to_search_magnifier_ = gtk_image_new_from_pixbuf( |
| 244 rb.GetNativeImageNamed(IDR_KEYWORD_SEARCH_MAGNIFIER)); | 244 rb.GetNativeImageNamed(IDR_KEYWORD_SEARCH_MAGNIFIER).ToGdkPixbuf()); |
| 245 gtk_box_pack_start(GTK_BOX(tab_to_search_hbox), tab_to_search_magnifier_, | 245 gtk_box_pack_start(GTK_BOX(tab_to_search_hbox), tab_to_search_magnifier_, |
| 246 FALSE, FALSE, 0); | 246 FALSE, FALSE, 0); |
| 247 gtk_util::CenterWidgetInHBox(tab_to_search_hbox, tab_to_search_label_hbox, | 247 gtk_util::CenterWidgetInHBox(tab_to_search_hbox, tab_to_search_label_hbox, |
| 248 false, 0); | 248 false, 0); |
| 249 | 249 |
| 250 // This creates a box around the keyword text with a border, background color, | 250 // This creates a box around the keyword text with a border, background color, |
| 251 // and padding around the text. | 251 // and padding around the text. |
| 252 tab_to_search_box_ = gtk_util::CreateGtkBorderBin( | 252 tab_to_search_box_ = gtk_util::CreateGtkBorderBin( |
| 253 tab_to_search_hbox, NULL, 1, 1, 1, 3); | 253 tab_to_search_hbox, NULL, 1, 1, 1, 3); |
| 254 gtk_widget_set_name(tab_to_search_box_, "chrome-tab-to-search-box"); | 254 gtk_widget_set_name(tab_to_search_box_, "chrome-tab-to-search-box"); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 274 gtk_box_pack_start(GTK_BOX(entry_box_), location_entry_alignment_, | 274 gtk_box_pack_start(GTK_BOX(entry_box_), location_entry_alignment_, |
| 275 TRUE, TRUE, 0); | 275 TRUE, TRUE, 0); |
| 276 | 276 |
| 277 // Tab to search notification (the hint on the right hand side). | 277 // Tab to search notification (the hint on the right hand side). |
| 278 tab_to_search_hint_ = gtk_hbox_new(FALSE, 0); | 278 tab_to_search_hint_ = gtk_hbox_new(FALSE, 0); |
| 279 gtk_widget_set_name(tab_to_search_hint_, "chrome-tab-to-search-hint"); | 279 gtk_widget_set_name(tab_to_search_hint_, "chrome-tab-to-search-hint"); |
| 280 tab_to_search_hint_leading_label_ = | 280 tab_to_search_hint_leading_label_ = |
| 281 theme_service_->BuildLabel("", kHintTextColor); | 281 theme_service_->BuildLabel("", kHintTextColor); |
| 282 gtk_widget_set_sensitive(tab_to_search_hint_leading_label_, FALSE); | 282 gtk_widget_set_sensitive(tab_to_search_hint_leading_label_, FALSE); |
| 283 tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf( | 283 tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf( |
| 284 rb.GetNativeImageNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB)); | 284 rb.GetNativeImageNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB).ToGdkPixbuf()); |
| 285 tab_to_search_hint_trailing_label_ = | 285 tab_to_search_hint_trailing_label_ = |
| 286 theme_service_->BuildLabel("", kHintTextColor); | 286 theme_service_->BuildLabel("", kHintTextColor); |
| 287 gtk_widget_set_sensitive(tab_to_search_hint_trailing_label_, FALSE); | 287 gtk_widget_set_sensitive(tab_to_search_hint_trailing_label_, FALSE); |
| 288 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), | 288 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), |
| 289 tab_to_search_hint_leading_label_, | 289 tab_to_search_hint_leading_label_, |
| 290 FALSE, FALSE, 0); | 290 FALSE, FALSE, 0); |
| 291 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), | 291 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), |
| 292 tab_to_search_hint_icon_, | 292 tab_to_search_hint_icon_, |
| 293 FALSE, FALSE, 0); | 293 FALSE, FALSE, 0); |
| 294 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), | 294 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 const TemplateURL* template_url = | 972 const TemplateURL* template_url = |
| 973 template_url_service->GetTemplateURLForKeyword(keyword); | 973 template_url_service->GetTemplateURLForKeyword(keyword); |
| 974 const SkBitmap& bitmap = profile->GetExtensionService()-> | 974 const SkBitmap& bitmap = profile->GetExtensionService()-> |
| 975 GetOmniboxIcon(template_url->GetExtensionId()); | 975 GetOmniboxIcon(template_url->GetExtensionId()); |
| 976 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); | 976 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); |
| 977 gtk_image_set_from_pixbuf(GTK_IMAGE(tab_to_search_magnifier_), pixbuf); | 977 gtk_image_set_from_pixbuf(GTK_IMAGE(tab_to_search_magnifier_), pixbuf); |
| 978 g_object_unref(pixbuf); | 978 g_object_unref(pixbuf); |
| 979 } else { | 979 } else { |
| 980 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 980 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 981 gtk_image_set_from_pixbuf(GTK_IMAGE(tab_to_search_magnifier_), | 981 gtk_image_set_from_pixbuf(GTK_IMAGE(tab_to_search_magnifier_), |
| 982 rb.GetNativeImageNamed(IDR_OMNIBOX_SEARCH)); | 982 rb.GetNativeImageNamed(IDR_OMNIBOX_SEARCH).ToGdkPixbuf()); |
| 983 } | 983 } |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 | 986 |
| 987 void LocationBarViewGtk::SetKeywordHintLabel(const string16& keyword) { | 987 void LocationBarViewGtk::SetKeywordHintLabel(const string16& keyword) { |
| 988 if (keyword.empty()) | 988 if (keyword.empty()) |
| 989 return; | 989 return; |
| 990 | 990 |
| 991 TemplateURLService* template_url_service = | 991 TemplateURLService* template_url_service = |
| 992 TemplateURLServiceFactory::GetForProfile(browser_->profile()); | 992 TemplateURLServiceFactory::GetForProfile(browser_->profile()); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 GdkModifierType modifier, | 1744 GdkModifierType modifier, |
| 1745 void* user_data) { | 1745 void* user_data) { |
| 1746 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); | 1746 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); |
| 1747 if (!gtk_widget_get_visible(view->widget())) | 1747 if (!gtk_widget_get_visible(view->widget())) |
| 1748 return FALSE; | 1748 return FALSE; |
| 1749 | 1749 |
| 1750 GdkEventButton event = {}; | 1750 GdkEventButton event = {}; |
| 1751 event.button = 1; | 1751 event.button = 1; |
| 1752 return view->OnButtonPressed(view->widget(), &event); | 1752 return view->OnButtonPressed(view->widget(), &event); |
| 1753 } | 1753 } |
| OLD | NEW |