summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 23:07:41 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 23:07:41 +0000
commit5e49546581a5a4c2c02d718f9d6e3dbebd7bebc7 (patch)
tree2a908845ceef1a7df68ff47eed5f2bd54d12cc9e /chrome/browser/tabs
parentdcda464d91fb97423f5b551babffe786b24ee251 (diff)
downloadchromium_src-5e49546581a5a4c2c02d718f9d6e3dbebd7bebc7.zip
chromium_src-5e49546581a5a4c2c02d718f9d6e3dbebd7bebc7.tar.gz
chromium_src-5e49546581a5a4c2c02d718f9d6e3dbebd7bebc7.tar.bz2
Adds various docking positions when dragging around a tab. I've added
the ability to dock to the following locations: Maximize the window on drop. Resize the window to fill up the left, bottom, or right half of the monitor. Tile the newly created window with an existing chrome window such that the two are on top of each other and fill the height of the monitor, or tiled such that they fill the width of the monitor. The graphics suxor. Glen says he'll come up with something better once its landed. BUG=none TEST=4628 Review URL: http://codereview.chromium.org/11325 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc6
-rw-r--r--chrome/browser/tabs/tab_strip_model.h10
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc4
3 files changed, 14 insertions, 6 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 176bf94..21ba9b5 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -401,9 +401,11 @@ void TabStripModel::SelectLastTab() {
}
void TabStripModel::TearOffTabContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds) {
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) {
DCHECK(detached_contents);
- delegate_->CreateNewStripWithContents(detached_contents, window_bounds);
+ 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 386599c..d5d56f2 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -18,6 +18,7 @@
namespace gfx {
class Point;
}
+class DockInfo;
class GURL;
class NavigationController;
class Profile;
@@ -94,8 +95,11 @@ 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) = 0;
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) = 0;
enum {
TAB_MOVE_ACTION = 1,
@@ -351,7 +355,8 @@ class TabStripModel : public NotificationObserver {
// The specified contents should be opened in a new tabstrip.
void TearOffTabContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds);
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info);
// Context menu functions.
enum ContextMenuCommand {
@@ -517,4 +522,3 @@ class TabStripModel : public NotificationObserver {
};
#endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H__
-
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 24c9b3c..071975f 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -4,6 +4,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "chrome/browser/dock_info.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/navigation_controller.h"
#include "chrome/browser/navigation_entry.h"
@@ -994,7 +995,8 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
// Overridden from TabStripModelDelegate:
virtual GURL GetBlankTabURL() const { return NewTabUIURL(); }
virtual void CreateNewStripWithContents(TabContents* contents,
- const gfx::Rect& window_bounds) {}
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info) {}
virtual int GetDragActions() const { return 0; }
virtual TabContents* CreateTabContentsForURL(
const GURL& url,