Index: chrome/browser/gtk/extension_installed_bubble_gtk.cc |
diff --git a/chrome/browser/gtk/extension_installed_bubble_gtk.cc b/chrome/browser/gtk/extension_installed_bubble_gtk.cc |
index 1e3d395824fa0e8d145ea5a2b794537d617e5aaa..b86d431e3241183b0fa6797a15dc38a256b62862 100644 |
--- a/chrome/browser/gtk/extension_installed_bubble_gtk.cc |
+++ b/chrome/browser/gtk/extension_installed_bubble_gtk.cc |
@@ -57,7 +57,9 @@ ExtensionInstalledBubbleGtk::ExtensionInstalledBubbleGtk( |
animation_wait_retries_(kAnimationWaitRetries) { |
AddRef(); // Balanced in Close(). |
- if (extension_->browser_action()) { |
+ if (!extension_->omnibox_keyword().empty()) { |
+ type_ = OMNIBOX_KEYWORD; |
+ } else if (extension_->browser_action()) { |
type_ = BROWSER_ACTION; |
} else if (extension->page_action() && |
!extension->page_action()->default_icon_path().empty()) { |
@@ -141,7 +143,13 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { |
gtk_container_check_resize(GTK_CONTAINER( |
browser_window->GetToolbar()->widget())); |
DCHECK(reference_widget); |
+ } else if (type_ == OMNIBOX_KEYWORD) { |
+ LocationBarViewGtk* location_bar_view = |
+ browser_window->GetToolbar()->GetLocationBarView(); |
+ reference_widget = location_bar_view->location_entry_widget(); |
+ DCHECK(reference_widget); |
} |
+ |
// Default case. |
if (reference_widget == NULL) |
reference_widget = browser_window->GetToolbar()->GetAppMenuButton(); |
@@ -201,9 +209,19 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { |
gtk_box_pack_start(GTK_BOX(text_column), heading_label, FALSE, FALSE, 0); |
// Page action label |
- if (type_ == ExtensionInstalledBubbleGtk::PAGE_ACTION) { |
+ if (type_ == PAGE_ACTION) { |
GtkWidget* info_label = gtk_label_new(l10n_util::GetStringUTF8( |
- IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO).c_str()); |
+ IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO).c_str()); |
+ gtk_label_set_line_wrap(GTK_LABEL(info_label), TRUE); |
+ gtk_widget_set_size_request(info_label, kTextColumnWidth, -1); |
+ gtk_box_pack_start(GTK_BOX(text_column), info_label, FALSE, FALSE, 0); |
+ } |
+ |
+ // Omnibox keyword label |
+ if (type_ == OMNIBOX_KEYWORD) { |
+ GtkWidget* info_label = gtk_label_new(l10n_util::GetStringFUTF8( |
+ IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, |
+ UTF8ToUTF16(extension_->omnibox_keyword())).c_str()); |
gtk_label_set_line_wrap(GTK_LABEL(info_label), TRUE); |
gtk_widget_set_size_request(info_label, kTextColumnWidth, -1); |
gtk_box_pack_start(GTK_BOX(text_column), info_label, FALSE, FALSE, 0); |
@@ -234,8 +252,23 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { |
!base::i18n::IsRTL() ? |
InfoBubbleGtk::ARROW_LOCATION_TOP_RIGHT : |
InfoBubbleGtk::ARROW_LOCATION_TOP_LEFT; |
+ |
+ gfx::Rect bounds = gtk_util::WidgetBounds(reference_widget); |
+ if (type_ == OMNIBOX_KEYWORD) { |
+ // Reverse the arrow for omnibox keywords, since the bubble will be on the |
+ // other side of the window. We also clear the width to avoid centering |
+ // the popup on the URL bar. |
+ arrow_location = |
+ !base::i18n::IsRTL() ? |
+ InfoBubbleGtk::ARROW_LOCATION_TOP_LEFT : |
+ InfoBubbleGtk::ARROW_LOCATION_TOP_RIGHT; |
+ if (base::i18n::IsRTL()) |
+ bounds.Offset(bounds.width(), 0); |
+ bounds.set_width(0); |
+ } |
+ |
info_bubble_ = InfoBubbleGtk::Show(reference_widget, |
- NULL, |
+ &bounds, |
bubble_content, |
arrow_location, |
true, // match_system_theme |