diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 18:43:41 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 18:43:41 +0000 |
commit | 990b3570337841be1c8eae8089132385cd86c6c3 (patch) | |
tree | 1e3abc790fd77e728f76a5f39f943c7ac670089c /chrome/browser/gtk | |
parent | 80d05152e2e6e1e1325f27df0ac54bcac2896648 (diff) | |
download | chromium_src-990b3570337841be1c8eae8089132385cd86c6c3.zip chromium_src-990b3570337841be1c8eae8089132385cd86c6c3.tar.gz chromium_src-990b3570337841be1c8eae8089132385cd86c6c3.tar.bz2 |
Linux: Fix browser actions overflow menu on incognito windows.
BUG=40757
TEST=drag handle so overflow menu shows (only when it actually should), click on icons from overflow.
Review URL: http://codereview.chromium.org/1539026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/browser_actions_toolbar_gtk.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc index 96a467e..d78b2f9 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc @@ -430,7 +430,7 @@ void BrowserActionsToolbarGtk::SetContainerWidth() { int showing_actions = model_->GetVisibleIconCount(); if (showing_actions >= 0) { SetButtonHBoxWidth(WidthForIconCount(showing_actions)); - if (showing_actions < static_cast<int>(model_->size())) + if (showing_actions < button_count()) gtk_widget_show(overflow_button_.widget()); } } @@ -615,7 +615,7 @@ void BrowserActionsToolbarGtk::DragStarted(BrowserActionButton* button, } void BrowserActionsToolbarGtk::SetButtonHBoxWidth(int new_width) { - gint max_width = WidthForIconCount(model_->size()); + gint max_width = WidthForIconCount(button_count()); new_width = std::min(max_width, new_width); new_width = std::max(new_width, 0); gtk_widget_set_size_request(button_hbox_.get(), new_width, -1); @@ -624,7 +624,7 @@ void BrowserActionsToolbarGtk::SetButtonHBoxWidth(int new_width) { gtk_chrome_shrinkable_hbox_get_visible_child_count( GTK_CHROME_SHRINKABLE_HBOX(button_hbox_.get())); - if (model_->size() > static_cast<size_t>(showing_icon_count)) { + if (button_count() > showing_icon_count) { if (!GTK_WIDGET_VISIBLE(overflow_button_.widget())) { // When the overflow chevron shows for the first time, take that // much space away from |button_hbox_| to make the drag look smoother. @@ -785,12 +785,16 @@ gboolean BrowserActionsToolbarGtk::OnOverflowButtonPress( int visible_icon_count = gtk_chrome_shrinkable_hbox_get_visible_child_count( GTK_CHROME_SHRINKABLE_HBOX(button_hbox_.get())); - for (int i = visible_icon_count; i < static_cast<int>(model_->size()); ++i) { - Extension* extension = model_->GetExtensionByIndex(i); + for (int i = visible_icon_count; i < button_count(); ++i) { + int model_index = i; + if (profile_->IsOffTheRecord()) + model_index = model_->IncognitoIndexToOriginal(i); + + Extension* extension = model_->GetExtensionByIndex(model_index); BrowserActionButton* button = extension_button_map_[extension->id()].get(); GtkWidget* menu_item = overflow_menu_->AppendMenuItemWithIcon( - i, + model_index, extension->name(), button->GetIcon()); |