summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/location_bar_view_gtk.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 19:55:17 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 19:55:17 +0000
commit1aa9e6ad9426c7a2c9051d92c6104cd1d25ea0af (patch)
tree56875ca6d8ec60d085d53ec676ec2da592a991db /chrome/browser/gtk/location_bar_view_gtk.cc
parentbebf8ceee960f5d93b63b99c240f2adc25836c79 (diff)
downloadchromium_src-1aa9e6ad9426c7a2c9051d92c6104cd1d25ea0af.zip
chromium_src-1aa9e6ad9426c7a2c9051d92c6104cd1d25ea0af.tar.gz
chromium_src-1aa9e6ad9426c7a2c9051d92c6104cd1d25ea0af.tar.bz2
Revert 57877 - Hide page actions and star, like we already do for content settings, when the user is editing the omnibox.
BUG=none TEST=Typing in the omnibox should make all items on the right disappear, and make ctrl-d do nothing. Review URL: http://codereview.chromium.org/3218002 TBR=pkasting@chromium.org Review URL: http://codereview.chromium.org/3264005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57894 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 6dd0795..95b1bbb 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -257,7 +257,7 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
gtk_box_pack_end(GTK_BOX(entry_box_), tab_to_search_hint_, FALSE, FALSE, 0);
// We don't show the star in popups, app windows, etc.
- if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) {
+ if (!ShouldOnlyShowLocation()) {
CreateStarButton();
gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0);
}
@@ -407,12 +407,6 @@ GtkWidget* LocationBarViewGtk::GetPageActionWidget(
}
void LocationBarViewGtk::Update(const TabContents* contents) {
- bool star_enabled = star_.get() && !toolbar_model_->input_in_progress();
- command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
- if (star_.get())
- gtk_widget_hide_all(star_.get());
- else
- gtk_widget_show_all(star_.get());
UpdateSiteTypeArea();
UpdateContentSettingsIcons();
UpdatePageActions();
@@ -621,10 +615,8 @@ void LocationBarViewGtk::UpdatePageActions() {
if (!page_action_views_.empty() && contents) {
GURL url = GURL(WideToUTF8(toolbar_model_->GetText()));
- for (size_t i = 0; i < page_action_views_.size(); i++) {
- page_action_views_[i]->UpdateVisibility(
- toolbar_model_->input_in_progress() ? NULL : contents, url);
- }
+ for (size_t i = 0; i < page_action_views_.size(); i++)
+ page_action_views_[i]->UpdateVisibility(contents, url);
}
// If there are no visible page actions, hide the hbox too, so that it does
@@ -1276,14 +1268,15 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
TabContents* contents, GURL url) {
// Save this off so we can pass it back to the extension when the action gets
// executed. See PageActionImageView::OnMousePressed.
- current_tab_id_ = contents ? ExtensionTabUtil::GetTabId(contents) : -1;
+ current_tab_id_ = ExtensionTabUtil::GetTabId(contents);
current_url_ = url;
- bool visible = contents &&
- (preview_enabled_ || page_action_->GetIsVisible(current_tab_id_));
+ bool visible = preview_enabled_ ||
+ page_action_->GetIsVisible(current_tab_id_);
if (visible) {
// Set the tooltip.
- gtk_widget_set_tooltip_text(event_box_.get(),
+ gtk_widget_set_tooltip_text(
+ event_box_.get(),
page_action_->GetTitle(current_tab_id_).c_str());
// Set the image.
@@ -1311,15 +1304,19 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
// Otherwise look for a dynamically set index, or fall back to the
// default path.
int icon_index = page_action_->GetIconIndex(current_tab_id_);
- std::string icon_path = (icon_index < 0) ?
- page_action_->default_icon_path() :
- page_action_->icon_paths()->at(icon_index);
+ std::string icon_path;
+ if (icon_index >= 0)
+ icon_path = page_action_->icon_paths()->at(icon_index);
+ else
+ icon_path = page_action_->default_icon_path();
+
if (!icon_path.empty()) {
PixbufMap::iterator iter = pixbufs_.find(icon_path);
if (iter != pixbufs_.end())
pixbuf = iter->second;
}
}
+
// The pixbuf might not be loaded yet.
if (pixbuf)
gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), pixbuf);