Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/helper.h" | 5 #include "chrome/browser/chromeos/login/helper.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/browser/chromeos/cros/network_library.h" | 8 #include "chrome/browser/chromeos/cros/network_library.h" |
| 9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 ThrobberHostView::ThrobberHostView() | 74 ThrobberHostView::ThrobberHostView() |
| 75 : host_view_(this), | 75 : host_view_(this), |
| 76 throbber_widget_(NULL) { | 76 throbber_widget_(NULL) { |
| 77 } | 77 } |
| 78 | 78 |
| 79 ThrobberHostView::~ThrobberHostView() { | 79 ThrobberHostView::~ThrobberHostView() { |
| 80 StopThrobber(); | 80 StopThrobber(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ThrobberHostView::StartThrobber() { | 83 void ThrobberHostView::StartThrobber() { |
| 84 #if defined(USE_AURA) | |
| 85 // TODO(saintlou): Is this still in use with the new WebUI anyway? | |
|
oshima
2011/09/19 15:52:39
this will be gone.
Emmanuel Saint-loubert-Bié
2011/09/19 20:15:36
Done.
| |
| 86 #else | |
| 84 StopThrobber(); | 87 StopThrobber(); |
| 85 | 88 |
| 86 views::Widget* host_widget = host_view_->GetWidget(); | 89 views::Widget* host_widget = host_view_->GetWidget(); |
| 87 if (!host_widget) { | 90 if (!host_widget) { |
| 88 LOG(WARNING) << "Failed to start the throbber: no Widget"; | 91 LOG(WARNING) << "Failed to start the throbber: no Widget"; |
| 89 return; | 92 return; |
| 90 } | 93 } |
| 91 | 94 |
| 92 GtkWidget* host_gtk_window = host_widget->GetNativeView(); | 95 GtkWidget* host_gtk_window = host_widget->GetNativeView(); |
| 93 while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window)) | 96 while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window)) |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 110 params.parent = host_gtk_window; | 113 params.parent = host_gtk_window; |
| 111 throbber_widget_->Init(params); | 114 throbber_widget_->Init(params); |
| 112 throbber_widget_->SetContentsView(throbber); | 115 throbber_widget_->SetContentsView(throbber); |
| 113 // This keeps the window from flashing at startup. | 116 // This keeps the window from flashing at startup. |
| 114 gdk_window_set_back_pixmap( | 117 gdk_window_set_back_pixmap( |
| 115 throbber_widget_->GetNativeView()->window, NULL, false); | 118 throbber_widget_->GetNativeView()->window, NULL, false); |
| 116 throbber_widget_->Show(); | 119 throbber_widget_->Show(); |
| 117 // WM can ignore bounds before widget is shown. | 120 // WM can ignore bounds before widget is shown. |
| 118 throbber_widget_->SetBounds(throbber_bounds); | 121 throbber_widget_->SetBounds(throbber_bounds); |
| 119 throbber->Start(); | 122 throbber->Start(); |
| 123 #endif | |
| 120 } | 124 } |
| 121 | 125 |
| 122 void ThrobberHostView::StopThrobber() { | 126 void ThrobberHostView::StopThrobber() { |
| 123 if (throbber_widget_) { | 127 if (throbber_widget_) { |
| 124 throbber_widget_->Close(); | 128 throbber_widget_->Close(); |
| 125 throbber_widget_ = NULL; | 129 throbber_widget_ = NULL; |
| 126 } | 130 } |
| 127 } | 131 } |
| 128 | 132 |
| 129 gfx::Rect ThrobberHostView::CalculateThrobberBounds(views::Throbber* throbber) { | 133 gfx::Rect ThrobberHostView::CalculateThrobberBounds(views::Throbber* throbber) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 gfx::Size preferred_size = NativeTextButton::GetPreferredSize(); | 225 gfx::Size preferred_size = NativeTextButton::GetPreferredSize(); |
| 222 // Set minimal width. | 226 // Set minimal width. |
| 223 if (preferred_size.width() < kButtonMinWidth) | 227 if (preferred_size.width() < kButtonMinWidth) |
| 224 preferred_size.set_width(kButtonMinWidth); | 228 preferred_size.set_width(kButtonMinWidth); |
| 225 return preferred_size; | 229 return preferred_size; |
| 226 } | 230 } |
| 227 | 231 |
| 228 } // namespace login | 232 } // namespace login |
| 229 | 233 |
| 230 } // namespace chromeos | 234 } // namespace chromeos |
| OLD | NEW |