Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: chrome/browser/chromeos/login/helper.cc

Issue 5964004: Use WINDOW instead of BUBBLE for the throbber widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos/login
Patch Set: merged Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/helper.cc
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index 2cfc6004bf842602b0441138edd94a857678aafd..14fc92b20774d84471eb0691cdd34c3109fc4898 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698