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/gtk | |
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/gtk')
-rw-r--r-- | chrome/browser/gtk/constrained_window_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/gtk/constrained_window_gtk.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 11 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.h | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.h | 2 |
6 files changed, 40 insertions, 5 deletions
diff --git a/chrome/browser/gtk/constrained_window_gtk.cc b/chrome/browser/gtk/constrained_window_gtk.cc index 1f53a59..c6380d6 100644 --- a/chrome/browser/gtk/constrained_window_gtk.cc +++ b/chrome/browser/gtk/constrained_window_gtk.cc @@ -11,7 +11,8 @@ ConstrainedWindowGtk::ConstrainedWindowGtk( TabContents* owner, ConstrainedWindowGtkDelegate* delegate) : owner_(owner), - delegate_(delegate) { + delegate_(delegate), + visible_(false) { DCHECK(owner); DCHECK(delegate); GtkWidget* dialog = delegate->GetWidgetRoot(); @@ -29,20 +30,25 @@ ConstrainedWindowGtk::ConstrainedWindowGtk( gtk_container_add(GTK_CONTAINER(frame), alignment); gtk_container_add(GTK_CONTAINER(ebox), frame); border_.Own(ebox); +} + +ConstrainedWindowGtk::~ConstrainedWindowGtk() { + border_.Destroy(); +} +void ConstrainedWindowGtk::ShowConstrainedWindow() { gtk_widget_show_all(border_.get()); // We collaborate with TabContentsViewGtk and stick ourselves in the // TabContentsViewGtk's floating container. ContainingView()->AttachConstrainedWindow(this); -} -ConstrainedWindowGtk::~ConstrainedWindowGtk() { - border_.Destroy(); + visible_ = true; } void ConstrainedWindowGtk::CloseConstrainedWindow() { - ContainingView()->RemoveConstrainedWindow(this); + if (visible_) + ContainingView()->RemoveConstrainedWindow(this); delegate_->DeleteDelegate(); owner_->WillClose(this); diff --git a/chrome/browser/gtk/constrained_window_gtk.h b/chrome/browser/gtk/constrained_window_gtk.h index f3ad8ec..fdfedf1 100644 --- a/chrome/browser/gtk/constrained_window_gtk.h +++ b/chrome/browser/gtk/constrained_window_gtk.h @@ -35,6 +35,7 @@ class ConstrainedWindowGtk : public ConstrainedWindow { virtual ~ConstrainedWindowGtk(); // Overridden from ConstrainedWindow: + virtual void ShowConstrainedWindow(); virtual void CloseConstrainedWindow(); // Returns the TabContents that constrains this Constrained Window. @@ -61,6 +62,9 @@ class ConstrainedWindowGtk : public ConstrainedWindow { // Delegate that provides the contents of this constrained window. ConstrainedWindowGtkDelegate* delegate_; + // Stores if |ShowConstrainedWindow()| has been called. + bool visible_; + DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); }; diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 501ecef..762f285 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -321,6 +321,17 @@ bool TabRendererGtk::is_pinned() const { return data_.pinned; } +void TabRendererGtk::SetBlocked(bool blocked) { + if (data_.blocked == blocked) + return; + data_.blocked = blocked; + // TODO(zelidrag) bug 32399: Make tabs pulse on Linux as well. +} + +bool TabRendererGtk::is_blocked() const { + return data_.blocked; +} + void TabRendererGtk::set_animating_pinned_change(bool value) { data_.animating_pinned_change = value; } diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h index 3114f05..0c50f12 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h @@ -104,6 +104,10 @@ class TabRendererGtk : public AnimationDelegate { virtual void UpdateData(TabContents* contents, bool loading_only); // Sets the pinned state of the tab. + void SetBlocked(bool pinned); + bool is_blocked() const; + + // Sets the pinned state of the tab. void set_pinned(bool pinned); bool is_pinned() const; @@ -235,6 +239,7 @@ class TabRendererGtk : public AnimationDelegate { bool off_the_record; bool show_icon; bool pinned; + bool blocked; bool animating_pinned_change; }; diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 0b5fa53..e27cdd7 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -954,6 +954,7 @@ void TabStripGtk::TabInsertedAt(TabContents* contents, tab->UpdateData(contents, false); } tab->set_pinned(model_->IsTabPinned(index)); + tab->SetBlocked(model_->IsTabBlocked(index)); if (gtk_widget_get_parent(tab->widget()) != tabstrip_.get()) gtk_fixed_put(GTK_FIXED(tabstrip_.get()), tab->widget(), 0, 0); @@ -1009,6 +1010,7 @@ void TabStripGtk::TabMoved(TabContents* contents, tab_data_.erase(tab_data_.begin() + from_index); TabData data = {tab, gfx::Rect()}; tab->set_pinned(model_->IsTabPinned(to_index)); + tab->SetBlocked(model_->IsTabBlocked(to_index)); tab_data_.insert(tab_data_.begin() + to_index, data); if (pinned_state_changed) { StartPinAndMoveTabAnimation(from_index, to_index, start_bounds); @@ -1038,6 +1040,11 @@ void TabStripGtk::TabPinnedStateChanged(TabContents* contents, int index) { StartPinnedTabAnimation(index); } +void TabStripGtk::TabBlockedStateChanged(TabContents* contents, int index) { + GetTabAt(index)->SetBlocked(model_->IsTabBlocked(index)); +} + + //////////////////////////////////////////////////////////////////////////////// // TabStripGtk, TabGtk::TabDelegate implementation: diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index 082f616..4533e7a 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -107,6 +107,8 @@ class TabStripGtk : public TabStripModelObserver, virtual void TabChangedAt(TabContents* contents, int index, TabChangeType change_type); virtual void TabPinnedStateChanged(TabContents* contents, int index); + virtual void TabBlockedStateChanged(TabContents* contents, + int index); // TabGtk::TabDelegate implementation: virtual bool IsTabSelected(const TabGtk* tab) const; |