summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 15:30:28 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 15:30:28 +0000
commit3d1104f27426048f4a951a614507b047fc7fd416 (patch)
tree559ee421338ba8fd85ea072bcde1003602086f30 /chrome/browser/tabs
parent10f2e7c37e44d513524f816a230d47b503362460 (diff)
downloadchromium_src-3d1104f27426048f4a951a614507b047fc7fd416.zip
chromium_src-3d1104f27426048f4a951a614507b047fc7fd416.tar.gz
chromium_src-3d1104f27426048f4a951a614507b047fc7fd416.tar.bz2
Allow live tabs to be dragged out of a window. Change TabStripModel such that
the caller must now explicitly show the newly created browser rather than it happening automatically. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc10
-rw-r--r--chrome/browser/tabs/tab_strip_model.h28
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc10
3 files changed, 31 insertions, 17 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 823b49e..821c80d 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -408,12 +408,12 @@ void TabStripModel::SelectLastTab() {
SelectTabContentsAt(count() - 1, true);
}
-void TabStripModel::TearOffTabContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info) {
+Browser* TabStripModel::TearOffTabContents(TabContents* detached_contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) {
DCHECK(detached_contents);
- delegate_->CreateNewStripWithContents(detached_contents, window_bounds,
- dock_info);
+ return delegate_->CreateNewStripWithContents(detached_contents, window_bounds,
+ dock_info);
}
// Context menu functions.
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index ab229da..8220f4d 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -15,6 +15,7 @@ namespace gfx {
class Point;
class Rect;
}
+class Browser;
class DockInfo;
class GURL;
class NavigationController;
@@ -96,10 +97,16 @@ class TabStripModelDelegate {
// Ask for a new TabStripModel to be created and the given tab contents to
// be added to it. Its size and position are reflected in |window_bounds|.
// If |dock_info|'s type is other than NONE, the newly created window should
- // be docked as identified by |dock_info|.
- virtual void CreateNewStripWithContents(TabContents* contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info) = 0;
+ // be docked as identified by |dock_info|. Returns the Browser object
+ // representing the newly created window and tab strip. This does not
+ // show the window, it's up to the caller to do so.
+ // TODO(pinkerton): I really don't like the fact that this is returning a
+ // Browser object, there may be some better abstraction we can achieve that
+ // the Browser implements, but for now, we'll experiment with returning
+ // that type.
+ virtual Browser* CreateNewStripWithContents(TabContents* contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) = 0;
enum {
TAB_MOVE_ACTION = 1,
@@ -364,10 +371,15 @@ class TabStripModel : public NotificationObserver {
// View API //////////////////////////////////////////////////////////////////
- // The specified contents should be opened in a new tabstrip.
- void TearOffTabContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info);
+ // The specified contents should be opened in a new tabstrip. Returns the
+ // Browser that holds it.
+ // TODO(pinkerton): I really don't like the fact that this is returning a
+ // Browser object, there may be some better abstraction we can achieve that
+ // the Browser implements, but for now, we'll experiment with returning
+ // that type.
+ Browser* TearOffTabContents(TabContents* detached_contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info);
// Context menu functions.
enum ContextMenuCommand {
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 8845024..c9006ce 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -31,12 +31,14 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
virtual ~TabStripDummyDelegate() {}
// Overridden from TabStripModelDelegate:
- virtual GURL GetBlankTabURL() const {
+ virtual GURL GetBlankTabURL() const {
return GURL(chrome::kChromeUINewTabURL);
}
- virtual void CreateNewStripWithContents(TabContents* contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info) {}
+ virtual Browser* CreateNewStripWithContents(TabContents* contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) {
+ return NULL;
+ }
virtual int GetDragActions() const { return 0; }
virtual TabContents* CreateTabContentsForURL(
const GURL& url,