| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "app/gfx/gtk_util.h" | 10 #include "app/gfx/gtk_util.h" |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_), | 642 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_), |
| 643 leading.c_str()); | 643 leading.c_str()); |
| 644 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_trailing_label_), | 644 gtk_label_set_text(GTK_LABEL(tab_to_search_hint_trailing_label_), |
| 645 trailing.c_str()); | 645 trailing.c_str()); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void LocationBarViewGtk::ShowFirstRunBubbleInternal(bool use_OEM_bubble) { | 648 void LocationBarViewGtk::ShowFirstRunBubbleInternal(bool use_OEM_bubble) { |
| 649 if (!location_entry_.get() || !widget()->window) | 649 if (!location_entry_.get() || !widget()->window) |
| 650 return; | 650 return; |
| 651 | 651 |
| 652 int x = widget()->allocation.x; | 652 gfx::Rect rect = gtk_util::GetWidgetRectRelativeToToplevel(widget()); |
| 653 int y = widget()->allocation.y; | 653 rect.set_width(0); |
| 654 rect.set_height(0); |
| 654 | 655 |
| 655 // The bubble needs to be just below the Omnibox and slightly to the right | 656 // The bubble needs to be just below the Omnibox and slightly to the right |
| 656 // of star button, so shift x and y co-ordinates. | 657 // of star button, so shift x and y co-ordinates. |
| 657 y += widget()->allocation.height + kFirstRunBubbleTopMargin; | 658 int y_offset = widget()->allocation.height + kFirstRunBubbleTopMargin; |
| 659 int x_offset = 0; |
| 658 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) | 660 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) |
| 659 x += kFirstRunBubbleLeftMargin; | 661 x_offset = kFirstRunBubbleLeftMargin; |
| 660 else | 662 else |
| 661 x += widget()->allocation.width - kFirstRunBubbleLeftMargin; | 663 x_offset = widget()->allocation.width - kFirstRunBubbleLeftMargin; |
| 664 rect.Offset(x_offset, y_offset); |
| 662 | 665 |
| 663 FirstRunBubble::Show(profile_, | 666 FirstRunBubble::Show(profile_, |
| 664 GTK_WINDOW(gtk_widget_get_toplevel(widget())), | 667 GTK_WINDOW(gtk_widget_get_toplevel(widget())), |
| 665 gfx::Rect(x, y, 0, 0), | 668 rect, |
| 666 use_OEM_bubble); | 669 use_OEM_bubble); |
| 667 } | 670 } |
| 668 | 671 |
| 669 // static | 672 // static |
| 670 gboolean LocationBarViewGtk::OnSecurityIconPressed( | 673 gboolean LocationBarViewGtk::OnSecurityIconPressed( |
| 671 GtkWidget* sender, | 674 GtkWidget* sender, |
| 672 GdkEventButton* event, | 675 GdkEventButton* event, |
| 673 LocationBarViewGtk* location_bar) { | 676 LocationBarViewGtk* location_bar) { |
| 674 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents(); | 677 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents(); |
| 675 NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); | 678 NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 const ExtensionActionState* state = | 823 const ExtensionActionState* state = |
| 821 contents->GetPageActionState(view->page_action_); | 824 contents->GetPageActionState(view->page_action_); |
| 822 if (!state || state->badge_text().empty()) | 825 if (!state || state->badge_text().empty()) |
| 823 return FALSE; | 826 return FALSE; |
| 824 | 827 |
| 825 gfx::CanvasPaint canvas(event, false); | 828 gfx::CanvasPaint canvas(event, false); |
| 826 gfx::Rect bounding_rect(widget->allocation); | 829 gfx::Rect bounding_rect(widget->allocation); |
| 827 state->PaintBadge(&canvas, bounding_rect); | 830 state->PaintBadge(&canvas, bounding_rect); |
| 828 return FALSE; | 831 return FALSE; |
| 829 } | 832 } |
| OLD | NEW |