summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-27 13:47:50 +0000
committeraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-27 13:47:50 +0000
commitc6d603c0b0ab529bf9bd34efe63ea0b2b5830aa1 (patch)
tree804e8e9f40d945d792b0dc224e0f69b9440bf310 /chrome/browser
parentcdc0f453e298e132beabaa4bc53a53b91b31b4aa (diff)
downloadchromium_src-c6d603c0b0ab529bf9bd34efe63ea0b2b5830aa1.zip
chromium_src-c6d603c0b0ab529bf9bd34efe63ea0b2b5830aa1.tar.gz
chromium_src-c6d603c0b0ab529bf9bd34efe63ea0b2b5830aa1.tar.bz2
Use WINDOW instead of BUBBLE for the throbber widget.
This fix solves the problem with the throbber widget is always shown on the top of the windows. Also it uses parent GtkWindow instead of GtkWidget. BUG=chromium-os:9770 TEST=manaual Review URL: http://codereview.chromium.org/5964004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/login/helper.cc48
1 files changed, 32 insertions, 16 deletions
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index 2cfc600..14fc92b 100644
--- a/chrome/browser/chromeos/login/helper.cc
+++ b/chrome/browser/chromeos/login/helper.cc
@@ -18,6 +18,7 @@
#include "views/painter.h"
#include "views/screen.h"
#include "views/widget/widget.h"
+#include "views/widget/widget_gtk.h"
namespace chromeos {
@@ -79,23 +80,38 @@ ThrobberHostView::~ThrobberHostView() {
void ThrobberHostView::StartThrobber() {
StopThrobber();
- views::Widget* widget = host_view_->GetWidget();
- if (widget) {
- views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber();
- throbber->set_stop_delay_ms(0);
- gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber);
-
- throbber_widget_ =
- views::Widget::CreatePopupWidget(views::Widget::Transparent,
- views::Widget::NotAcceptEvents,
- views::Widget::DeleteOnDestroy,
- views::Widget::DontMirrorOriginInRTL);
- throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
- throbber_widget_->InitWithWidget(widget, throbber_bounds);
- throbber_widget_->SetContentsView(throbber);
- throbber_widget_->Show();
- throbber->Start();
+
+ views::Widget* host_widget = host_view_->GetWidget();
+ if (!host_widget) {
+ LOG(WARNING) << "Failed to start the throbber: no Widget";
+ return;
+ }
+
+ GtkWidget* host_gtk_window = host_widget->GetNativeView();
+ while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window))
+ host_gtk_window = gtk_widget_get_parent(host_gtk_window);
+ if (!host_gtk_window) {
+ LOG(WARNING) << "Failed to start the throbber: no GtkWindow";
+ return;
}
+
+ views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber();
+ throbber->set_stop_delay_ms(0);
+ gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber);
+
+ views::WidgetGtk* widget_gtk =
+ new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
+ widget_gtk->make_transient_to_parent();
+ widget_gtk->MakeTransparent();
+ throbber_widget_ = widget_gtk;
+
+ throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
+ throbber_widget_->Init(host_gtk_window, throbber_bounds);
+ throbber_widget_->SetContentsView(throbber);
+ throbber_widget_->Show();
+ // WM can ignore bounds before widget is shown.
+ throbber_widget_->SetBounds(throbber_bounds);
+ throbber->Start();
}
void ThrobberHostView::StopThrobber() {