summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk
diff options
context:
space:
mode:
authorjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 16:06:05 +0000
committerjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 16:06:05 +0000
commit4ce39887a02c9877976b7e6686a877dd0961c7a2 (patch)
tree5cb84e28ca7ccca9998f17148bfd5dd5efd4c0d8 /chrome/browser/gtk
parent6e6f2bb1d57b20c85e4636504bd723f75a7b3200 (diff)
downloadchromium_src-4ce39887a02c9877976b7e6686a877dd0961c7a2.zip
chromium_src-4ce39887a02c9877976b7e6686a877dd0961c7a2.tar.gz
chromium_src-4ce39887a02c9877976b7e6686a877dd0961c7a2.tar.bz2
Add pinned property to tabs.update and create.
Fire tabs.onUpdated event if a tab's pinned state changes. BUG=24781 TEST=ExtensionApiTest Review URL: http://codereview.chromium.org/3816005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.cc26
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.h5
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc7
3 files changed, 22 insertions, 16 deletions
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index 22bdcff..318fcbe 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -417,6 +417,19 @@ void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) {
PaintIcon(&canvas);
}
+bool TabRendererGtk::ShouldShowIcon() const {
+ if (mini() && height() >= GetMinimumUnselectedSize().height()) {
+ return true;
+ } else if (!data_.show_icon) {
+ return false;
+ } else if (IsSelected()) {
+ // The selected tab clips favicon before close button.
+ return IconCapacity() >= 2;
+ }
+ // Non-selected tabs clip close button before favicon.
+ return IconCapacity() >= 1;
+}
+
// static
gfx::Size TabRendererGtk::GetMinimumUnselectedSize() {
InitResources();
@@ -960,19 +973,6 @@ int TabRendererGtk::IconCapacity() const {
return (width() - kLeftPadding - kRightPadding) / kFavIconSize;
}
-bool TabRendererGtk::ShouldShowIcon() const {
- if (mini() && height() >= GetMinimumUnselectedSize().height()) {
- return true;
- } else if (!data_.show_icon) {
- return false;
- } else if (IsSelected()) {
- // The selected tab clips favicon before close button.
- return IconCapacity() >= 2;
- }
- // Non-selected tabs clip close button before favicon.
- return IconCapacity() >= 1;
-}
-
bool TabRendererGtk::ShouldShowCloseBox() const {
// The selected tab never clips close button.
return !mini() && (IsSelected() || IconCapacity() >= 3);
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index b25e001..51f11b7 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -171,6 +171,9 @@ class TabRendererGtk : public AnimationDelegate,
// Repaint only the area of the tab that contains the favicon.
void PaintFavIconArea(GdkEventExpose* event);
+ // Returns whether the Tab should display a favicon.
+ bool ShouldShowIcon() const;
+
// Returns the minimum possible size of a single unselected Tab.
static gfx::Size GetMinimumUnselectedSize();
// Returns the minimum possible size of a selected Tab. Selected tabs must
@@ -340,8 +343,6 @@ class TabRendererGtk : public AnimationDelegate,
// current size.
int IconCapacity() const;
- // Returns whether the Tab should display a favicon.
- bool ShouldShowIcon() const;
// Returns whether the Tab should display a close button.
bool ShouldShowCloseBox() const;
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 3d026b1..0547815 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -1050,6 +1050,10 @@ void TabStripGtk::TabReplacedAt(TabContents* old_contents,
}
void TabStripGtk::TabMiniStateChanged(TabContents* contents, int index) {
+ // Don't do anything if we've already picked up the change from TabMoved.
+ if (GetTabAt(index)->mini() == model_->IsMiniTab(index))
+ return;
+
GetTabAt(index)->set_mini(model_->IsMiniTab(index));
// Don't animate if the window isn't visible yet. The window won't be visible
// when dragging a mini-tab to a new window.
@@ -2007,7 +2011,8 @@ bool TabStripGtk::CanPaintOnlyFavIcons(const GdkRectangle* rects,
for (int r = 0; r < num_rects; ++r) {
while (t < GetTabCount()) {
TabGtk* tab = GetTabAt(t);
- if (GdkRectMatchesTabFavIconBounds(rects[r], tab)) {
+ if (GdkRectMatchesTabFavIconBounds(rects[r], tab) &&
+ tab->ShouldShowIcon()) {
tabs_to_paint->push_back(t);
++t;
break;