summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/tabs
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 23:44:02 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 23:44:02 +0000
commit7a613e3ae4aa9feaa45b93b547dcbe01177808c8 (patch)
tree82f7cf3320877885f43ca1ef060e5975a440d997 /chrome/browser/gtk/tabs
parentb6887a6c999a63d04a513edd227a939f2bfa1aa6 (diff)
downloadchromium_src-7a613e3ae4aa9feaa45b93b547dcbe01177808c8.zip
chromium_src-7a613e3ae4aa9feaa45b93b547dcbe01177808c8.tar.gz
chromium_src-7a613e3ae4aa9feaa45b93b547dcbe01177808c8.tar.bz2
GTK: Add view ids to our widgets. These will be used for testing.
Also add unit test to test test infrastructure. BUG=19214 Review URL: http://codereview.chromium.org/164519 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tabs')
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc22
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h7
2 files changed, 28 insertions, 1 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index f6ed7d8..803c026 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -722,6 +722,8 @@ void TabStripGtk::Init() {
drop_indicator_width = gdk_pixbuf_get_width(drop_image);
drop_indicator_height = gdk_pixbuf_get_height(drop_image);
}
+
+ ViewIDUtil::SetDelegateForWidget(widget(), this);
}
void TabStripGtk::Show() {
@@ -849,6 +851,26 @@ gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) {
}
////////////////////////////////////////////////////////////////////////////////
+// ViewIDUtil::Delegate implementation
+
+GtkWidget* TabStripGtk::GetWidgetForViewID(ViewID view_id) {
+ if (GetTabCount() > 0) {
+ if (view_id == VIEW_ID_TAB_LAST) {
+ return GetTabAt(GetTabCount() - 1)->widget();
+ } else if ((view_id >= VIEW_ID_TAB_0) && (view_id < VIEW_ID_TAB_LAST)) {
+ int index = view_id - VIEW_ID_TAB_0;
+ if (index >= 0 && index < GetTabCount()) {
+ return GetTabAt(index)->widget();
+ } else {
+ return NULL;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// TabStripGtk, TabStripModelObserver implementation:
void TabStripGtk::TabInsertedAt(TabContents* contents,
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 69e4372..5445654 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -13,6 +13,7 @@
#include "base/task.h"
#include "base/message_loop.h"
#include "chrome/browser/gtk/tabs/tab_gtk.h"
+#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/owned_widget_gtk.h"
@@ -24,7 +25,8 @@ class GtkThemeProvider;
class TabStripGtk : public TabStripModelObserver,
public TabGtk::TabDelegate,
public MessageLoopForUI::Observer,
- public NotificationObserver {
+ public NotificationObserver,
+ public ViewIDUtil::Delegate {
public:
class TabAnimation;
@@ -86,6 +88,9 @@ class TabStripGtk : public TabStripModelObserver,
// allocated.
gfx::Point GetTabStripOriginForWidget(GtkWidget* widget);
+ // ViewIDUtil::Delegate implementation ---------------------------------------
+ virtual GtkWidget* GetWidgetForViewID(ViewID id);
+
protected:
// TabStripModelObserver implementation:
virtual void TabInsertedAt(TabContents* contents,