| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 void LocationBarViewGtk::Update(const WebContents* contents) { | 450 void LocationBarViewGtk::Update(const WebContents* contents) { |
| 451 UpdateStarIcon(); | 451 UpdateStarIcon(); |
| 452 UpdateSiteTypeArea(); | 452 UpdateSiteTypeArea(); |
| 453 UpdateContentSettingsIcons(); | 453 UpdateContentSettingsIcons(); |
| 454 UpdatePageActions(); | 454 UpdatePageActions(); |
| 455 location_entry_->Update(contents); | 455 location_entry_->Update(contents); |
| 456 // The security level (background color) could have changed, etc. | 456 // The security level (background color) could have changed, etc. |
| 457 if (theme_service_->UsingNativeTheme()) { | 457 if (theme_service_->UsingNativeTheme()) { |
| 458 // In GTK mode, we need our parent to redraw, as it draws the text entry | 458 // In GTK mode, we need our parent to redraw, as it draws the text entry |
| 459 // border. | 459 // border. |
| 460 gtk_widget_queue_draw(widget()->parent); | 460 gtk_widget_queue_draw(gtk_widget_get_parent(widget())); |
| 461 } else { | 461 } else { |
| 462 gtk_widget_queue_draw(widget()); | 462 gtk_widget_queue_draw(widget()); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 void LocationBarViewGtk::OnAutocompleteAccept(const GURL& url, | 466 void LocationBarViewGtk::OnAutocompleteAccept(const GURL& url, |
| 467 WindowOpenDisposition disposition, | 467 WindowOpenDisposition disposition, |
| 468 content::PageTransition transition, | 468 content::PageTransition transition, |
| 469 const GURL& alternate_nav_url) { | 469 const GURL& alternate_nav_url) { |
| 470 if (url.is_valid()) { | 470 if (url.is_valid()) { |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 keyword_hint.substr(0, content_param_offsets.front()))); | 1011 keyword_hint.substr(0, content_param_offsets.front()))); |
| 1012 std::string trailing(UTF16ToUTF8( | 1012 std::string trailing(UTF16ToUTF8( |
| 1013 keyword_hint.substr(content_param_offsets.front()))); | 1013 keyword_hint.substr(content_param_offsets.front()))); |
| 1014 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_), | 1014 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_), |
| 1015 leading.c_str()); | 1015 leading.c_str()); |
| 1016 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_trailing_label_), | 1016 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_trailing_label_), |
| 1017 trailing.c_str()); | 1017 trailing.c_str()); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void LocationBarViewGtk::ShowFirstRunBubbleInternal() { | 1020 void LocationBarViewGtk::ShowFirstRunBubbleInternal() { |
| 1021 if (!location_entry_.get() || !widget()->window) | 1021 if (!location_entry_.get() || !gtk_widget_get_window(widget())) |
| 1022 return; | 1022 return; |
| 1023 | 1023 |
| 1024 gfx::Rect bounds = gtk_util::WidgetBounds(location_icon_image_); | 1024 gfx::Rect bounds = gtk_util::WidgetBounds(location_icon_image_); |
| 1025 bounds.set_x(bounds.x() + kFirstRunBubbleLeftSpacing); | 1025 bounds.set_x(bounds.x() + kFirstRunBubbleLeftSpacing); |
| 1026 FirstRunBubble::Show(browser_->profile(), location_icon_image_, bounds); | 1026 FirstRunBubble::Show(browser_->profile(), location_icon_image_, bounds); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender, | 1029 gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender, |
| 1030 GdkEventButton* event) { | 1030 GdkEventButton* event) { |
| 1031 WebContents* tab = GetWebContents(); | 1031 WebContents* tab = GetWebContents(); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 TRACE_EVENT0("ui::gtk", | 1388 TRACE_EVENT0("ui::gtk", |
| 1389 "LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose"); | 1389 "LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose"); |
| 1390 | 1390 |
| 1391 if (!(animation_.IsShowing() || animation_.IsClosing())) | 1391 if (!(animation_.IsShowing() || animation_.IsClosing())) |
| 1392 return FALSE; | 1392 return FALSE; |
| 1393 | 1393 |
| 1394 GtkAllocation allocation; | 1394 GtkAllocation allocation; |
| 1395 gtk_widget_get_allocation(sender, &allocation); | 1395 gtk_widget_get_allocation(sender, &allocation); |
| 1396 const int height = allocation.height; | 1396 const int height = allocation.height; |
| 1397 | 1397 |
| 1398 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 1398 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender)); |
| 1399 gdk_cairo_rectangle(cr, &event->area); | 1399 gdk_cairo_rectangle(cr, &event->area); |
| 1400 cairo_clip(cr); | 1400 cairo_clip(cr); |
| 1401 | 1401 |
| 1402 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); | 1402 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); |
| 1403 | 1403 |
| 1404 cairo_pattern_add_color_stop_rgb(pattern, 0.0, | 1404 cairo_pattern_add_color_stop_rgb(pattern, 0.0, |
| 1405 kContentSettingTopColor[0], | 1405 kContentSettingTopColor[0], |
| 1406 kContentSettingTopColor[1], | 1406 kContentSettingTopColor[1], |
| 1407 kContentSettingTopColor[2]); | 1407 kContentSettingTopColor[2]); |
| 1408 cairo_pattern_add_color_stop_rgb(pattern, 1.0, | 1408 cairo_pattern_add_color_stop_rgb(pattern, 1.0, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1646 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1647 if (badge_text.empty()) | 1647 if (badge_text.empty()) |
| 1648 return FALSE; | 1648 return FALSE; |
| 1649 | 1649 |
| 1650 gfx::CanvasSkiaPaint canvas(event, false); | 1650 gfx::CanvasSkiaPaint canvas(event, false); |
| 1651 GtkAllocation allocation; | 1651 GtkAllocation allocation; |
| 1652 gtk_widget_get_allocation(widget, &allocation); | 1652 gtk_widget_get_allocation(widget, &allocation); |
| 1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); | 1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); |
| 1654 return FALSE; | 1654 return FALSE; |
| 1655 } | 1655 } |
| OLD | NEW |