Chromium Code Reviews| 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..5d6f50331c29954a46c2680e07fb6d803a38c03b 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,21 @@ 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; |
| + bounds.set_width(0); |
|
Aaron Boodman
2010/11/11 02:55:30
Do you have a screenshot of what this ends up look
Matt Perry
2010/11/12 07:20:25
I attached screenshots of the Windows UI to the bu
|
| + } |
| + |
| info_bubble_ = InfoBubbleGtk::Show(reference_widget, |
| - NULL, |
| + &bounds, |
| bubble_content, |
| arrow_location, |
| true, // match_system_theme |