diff options
author | zelidrag@google.com <zelidrag@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 21:49:44 +0000 |
---|---|---|
committer | zelidrag@google.com <zelidrag@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 21:49:44 +0000 |
commit | fa1cf0b87092ed3f3069a8549270f999e05cca20 (patch) | |
tree | 71c08950f340004c1107776d0d4962d8b38bfb8e /chrome/browser/tabs | |
parent | 18db63ea67ad2f5e428022e32ff55de83c0db0ca (diff) | |
download | chromium_src-fa1cf0b87092ed3f3069a8549270f999e05cca20.zip chromium_src-fa1cf0b87092ed3f3069a8549270f999e05cca20.tar.gz chromium_src-fa1cf0b87092ed3f3069a8549270f999e05cca20.tar.bz2 |
Tab-modal dialog improvements:
- treat constrained dialogs as tab-modal - only one shows at the time
- added visual indication (tab pulsing) to the tab strip when a tab is blocked by a tab-modal dialog
- blocked all UI activity from rendrer host and forced refocusing on constrained (tab-modal) dialogs
This CL reverts http://codereview.chromium.org/384113 and instead incorporates the changes from http://codereview.chromium.org/392018.
BUG=456,27585,27620
TEST=Go to http://www/~thakis/cgi-bin/test.html, hit esc.
Review URL: http://codereview.chromium.org/541056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 14 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.h | 17 |
2 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 783e27c..56ec106 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -342,6 +342,16 @@ bool TabStripModel::ShouldResetGroupOnSelect(TabContents* contents) const { return contents_data_.at(index)->reset_group_on_select; } +void TabStripModel::SetTabBlocked(int index, bool blocked) { + DCHECK(ContainsIndex(index)); + if (contents_data_[index]->blocked == blocked) + return; + contents_data_[index]->blocked = blocked; + FOR_EACH_OBSERVER(TabStripModelObserver, observers_, + TabBlockedStateChanged(contents_data_[index]->contents, + index)); +} + void TabStripModel::SetTabPinned(int index, bool pinned) { DCHECK(ContainsIndex(index)); if (contents_data_[index]->pinned == pinned) @@ -373,6 +383,10 @@ bool TabStripModel::IsTabPinned(int index) const { return contents_data_[index]->pinned; } +bool TabStripModel::IsTabBlocked(int index) const { + return contents_data_[index]->blocked; +} + int TabStripModel::IndexOfFirstNonPinnedTab() const { for (size_t i = 0; i < contents_data_.size(); ++i) { if (!contents_data_[i]->pinned) diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index fe94524..bdd92c3 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -105,6 +105,11 @@ class TabStripModelObserver { // notified by way of the TabMoved method with |pinned_state_changed| true. virtual void TabPinnedStateChanged(TabContents* contents, int index) { } + // Invoked when the blocked state of a tab changes. + // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal + // window. + virtual void TabBlockedStateChanged(TabContents* contents, int index) { } + // The TabStripModel now no longer has any "significant" (user created or // user manipulated) tabs. The implementer may use this as a trigger to try // and close the window containing the TabStripModel, for example... @@ -419,6 +424,9 @@ class TabStripModel : public NotificationObserver { // should be reset when _any_ selection change occurs in the model. bool ShouldResetGroupOnSelect(TabContents* contents) const; + // Changes the blocked state of the tab at |index|. + void SetTabBlocked(int index, bool blocked); + // Changes the pinned state of the tab at |index|. See description above // class for details on this. void SetTabPinned(int index, bool pinned); @@ -426,6 +434,9 @@ class TabStripModel : public NotificationObserver { // Returns true if the tab at |index| is pinned. bool IsTabPinned(int index) const; + // Returns true if the tab at |index| is blocked by a tab modal dialog. + bool IsTabBlocked(int index) const; + // Returns the index of the first tab that is not pinned. This returns // |count()| if all of the tabs are pinned, and 0 if no tabs are pinned. int IndexOfFirstNonPinnedTab() const; @@ -568,7 +579,8 @@ class TabStripModel : public NotificationObserver { explicit TabContentsData(TabContents* a_contents) : contents(a_contents), reset_group_on_select(false), - pinned(false) { + pinned(false), + blocked(false) { SetGroup(NULL); } @@ -612,6 +624,9 @@ class TabStripModel : public NotificationObserver { // Is the tab pinned? bool pinned; + + // Is the tab interaction blocked by a modal dialog? + bool blocked; }; // The TabContents data currently hosted within this TabStripModel. |