summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/status_bubble_gtk.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 22:55:21 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 22:55:21 +0000
commit97dc320a8fd7b25abbac5b35d6cc49111668416b (patch)
tree0e4ef92d4bc7a19d22bd9e15e2b04bd9e04ba0a6 /chrome/browser/gtk/status_bubble_gtk.cc
parent01dbd931735c7b7497b7b83664462512f272bf58 (diff)
downloadchromium_src-97dc320a8fd7b25abbac5b35d6cc49111668416b.zip
chromium_src-97dc320a8fd7b25abbac5b35d6cc49111668416b.tar.gz
chromium_src-97dc320a8fd7b25abbac5b35d6cc49111668416b.tar.bz2
GTK: Fix status bubble hiding during background tab events.
So the GTK version had only one status, setting the status to any URL the user hovered over. When the background tab is done with loading, it sends a SetStatus("") to the StatusBubble. This was what was tickling the bug. So I'm copying the Windows implementation, which can have a URL and a status, with the URL's display overriding the status display. So when the background tab calls SetStatus(""), the URL should still be displayed. http://crbug.com/14802 Review URL: http://codereview.chromium.org/147050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/status_bubble_gtk.cc')
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.cc44
1 files changed, 32 insertions, 12 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc
index 7b377b1..f747570 100644
--- a/chrome/browser/gtk/status_bubble_gtk.cc
+++ b/chrome/browser/gtk/status_bubble_gtk.cc
@@ -40,23 +40,34 @@ StatusBubbleGtk::~StatusBubbleGtk() {
container_.Destroy();
}
-void StatusBubbleGtk::SetStatus(const std::string& status) {
- if (status.empty()) {
- HideInASecond();
+void StatusBubbleGtk::SetStatus(const std::wstring& status_text_wide) {
+ std::string status_text = WideToUTF8(status_text_wide);
+ if (status_text_ == status_text)
return;
- }
- gtk_label_set_text(GTK_LABEL(label_), status.c_str());
-
- Show();
-}
-
-void StatusBubbleGtk::SetStatus(const std::wstring& status) {
- SetStatus(WideToUTF8(status));
+ status_text_ = status_text;
+ if (!status_text_.empty()) {
+ SetStatusTextTo(status_text_);
+ } else if (!url_text_.empty()) {
+ SetStatusTextTo(url_text_);
+ } else {
+ SetStatusTextTo(std::string());
+ }
}
void StatusBubbleGtk::SetURL(const GURL& url, const std::wstring& languages) {
- SetStatus(url.possibly_invalid_spec());
+ // If we want to clear a displayed URL but there is a status still to
+ // display, display that status instead.
+ if (url.is_empty() && !status_text_.empty()) {
+ url_text_ = std::string();
+ SetStatusTextTo(status_text_);
+ return;
+ }
+
+ // TODO(erg): We probably want to elide the text from the GURL object.
+ url_text_ = url.possibly_invalid_spec();
+
+ SetStatusTextTo(url_text_);
}
void StatusBubbleGtk::Show() {
@@ -73,6 +84,15 @@ void StatusBubbleGtk::Hide() {
gtk_widget_hide_all(container_.get());
}
+void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) {
+ if (status_utf8.empty()) {
+ HideInASecond();
+ } else {
+ gtk_label_set_text(GTK_LABEL(label_), status_utf8.c_str());
+ Show();
+ }
+}
+
void StatusBubbleGtk::HideInASecond() {
if (!timer_factory_.empty())
timer_factory_.RevokeAll();