summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 18:41:11 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 18:41:11 +0000
commit4a1267c6213345bb805fe1f737e9e91fc9ba38e5 (patch)
tree31a3db9f3fae934196a1370e4fe6cc0a29c1dfde
parentd02a21b84b9829a46e22466ebcd64da93c9479de (diff)
downloadchromium_src-4a1267c6213345bb805fe1f737e9e91fc9ba38e5.zip
chromium_src-4a1267c6213345bb805fe1f737e9e91fc9ba38e5.tar.gz
chromium_src-4a1267c6213345bb805fe1f737e9e91fc9ba38e5.tar.bz2
GTK: don't show the star or page actions in ShouldOnlyShowLocation situations.
BUG=40204 TEST=manual Review URL: http://codereview.chromium.org/1549024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43977 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc19
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h4
2 files changed, 20 insertions, 3 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 27ea366..ed089bc 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -307,8 +307,11 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
// by SetSecurityIcon() and SetInfoText().
gtk_box_pack_end(GTK_BOX(hbox_.get()), security_info_label_, FALSE, FALSE, 0);
- CreateStarButton();
- gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0);
+ // We don't show the star in popups, app windows, etc.
+ if (!ShouldOnlyShowLocation()) {
+ CreateStarButton();
+ gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0);
+ }
content_setting_hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding));
gtk_widget_set_name(content_setting_hbox_.get(),
@@ -645,7 +648,7 @@ void LocationBarViewGtk::UpdatePageActions() {
// If there are no visible page actions, hide the hbox too, so that it does
// not affect the padding in the location bar.
- if (PageActionVisibleCount())
+ if (PageActionVisibleCount() && !ShouldOnlyShowLocation())
gtk_widget_show(page_action_hbox_.get());
else
gtk_widget_hide(page_action_hbox_.get());
@@ -921,6 +924,9 @@ gboolean LocationBarViewGtk::OnStarButtonPress(GtkWidget* widget,
void LocationBarViewGtk::ShowStarBubble(const GURL& url,
bool newly_bookmarked) {
+ if (!star_.get())
+ return;
+
BookmarkBubbleGtk::Show(star_.get(), profile_, url, newly_bookmarked);
}
@@ -933,11 +939,18 @@ void LocationBarViewGtk::SetStarred(bool starred) {
}
void LocationBarViewGtk::UpdateStarIcon() {
+ if (!star_.get())
+ return;
+
gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_),
theme_provider_->GetPixbufNamed(
starred_ ? IDR_OMNIBOX_STAR_LIT : IDR_OMNIBOX_STAR));
}
+bool LocationBarViewGtk::ShouldOnlyShowLocation() {
+ return browser_->type() != Browser::TYPE_NORMAL;
+}
+
void LocationBarViewGtk::AdjustChildrenVisibility() {
int text_width = location_entry_->TextWidth();
int available_width = entry_box_width_ - text_width - kInnerPadding;
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index 16373ad..500619b 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -302,6 +302,10 @@ class LocationBarViewGtk : public AutocompleteEditController,
// Update the star icon after it is toggled or the theme changes.
void UpdateStarIcon();
+ // Returns true if we should only show the URL and none of the extras like
+ // the star button or page actions.
+ bool ShouldOnlyShowLocation();
+
// The outermost widget we want to be hosted.
OwnedWidgetGtk hbox_;