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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "chrome/browser/chromeos/cros/network_library.h" | 9 #include "chrome/browser/chromeos/cros/network_library.h" |
10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ThrobberHostView::ThrobberHostView() | 75 ThrobberHostView::ThrobberHostView() |
76 : host_view_(this), | 76 : host_view_(this), |
77 throbber_widget_(NULL) { | 77 throbber_widget_(NULL) { |
78 } | 78 } |
79 | 79 |
80 ThrobberHostView::~ThrobberHostView() { | 80 ThrobberHostView::~ThrobberHostView() { |
81 StopThrobber(); | 81 StopThrobber(); |
82 } | 82 } |
83 | 83 |
84 void ThrobberHostView::StartThrobber() { | 84 void ThrobberHostView::StartThrobber() { |
| 85 #if defined(TOOLKIT_USES_GTK) |
85 StopThrobber(); | 86 StopThrobber(); |
86 | 87 |
87 views::Widget* host_widget = host_view_->GetWidget(); | 88 views::Widget* host_widget = host_view_->GetWidget(); |
88 if (!host_widget) { | 89 if (!host_widget) { |
89 LOG(WARNING) << "Failed to start the throbber: no Widget"; | 90 LOG(WARNING) << "Failed to start the throbber: no Widget"; |
90 return; | 91 return; |
91 } | 92 } |
92 | 93 |
93 GtkWidget* host_gtk_window = host_widget->GetNativeView(); | 94 GtkWidget* host_gtk_window = host_widget->GetNativeView(); |
94 while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window)) | 95 while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window)) |
(...skipping 16 matching lines...) Expand all Loading... |
111 params.parent = host_gtk_window; | 112 params.parent = host_gtk_window; |
112 throbber_widget_->Init(params); | 113 throbber_widget_->Init(params); |
113 throbber_widget_->SetContentsView(throbber); | 114 throbber_widget_->SetContentsView(throbber); |
114 // This keeps the window from flashing at startup. | 115 // This keeps the window from flashing at startup. |
115 gdk_window_set_back_pixmap( | 116 gdk_window_set_back_pixmap( |
116 throbber_widget_->GetNativeView()->window, NULL, false); | 117 throbber_widget_->GetNativeView()->window, NULL, false); |
117 throbber_widget_->Show(); | 118 throbber_widget_->Show(); |
118 // WM can ignore bounds before widget is shown. | 119 // WM can ignore bounds before widget is shown. |
119 throbber_widget_->SetBounds(throbber_bounds); | 120 throbber_widget_->SetBounds(throbber_bounds); |
120 throbber->Start(); | 121 throbber->Start(); |
| 122 #else |
| 123 // TODO(saintlou): Do we need a throbber for Aura? |
| 124 NOTIMPLEMENTED(); |
| 125 #endif |
121 } | 126 } |
122 | 127 |
123 void ThrobberHostView::StopThrobber() { | 128 void ThrobberHostView::StopThrobber() { |
124 if (throbber_widget_) { | 129 if (throbber_widget_) { |
125 throbber_widget_->Close(); | 130 throbber_widget_->Close(); |
126 throbber_widget_ = NULL; | 131 throbber_widget_ = NULL; |
127 } | 132 } |
128 } | 133 } |
129 | 134 |
130 gfx::Rect ThrobberHostView::CalculateThrobberBounds(views::Throbber* throbber) { | 135 gfx::Rect ThrobberHostView::CalculateThrobberBounds(views::Throbber* throbber) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 gfx::Size preferred_size = NativeTextButton::GetPreferredSize(); | 227 gfx::Size preferred_size = NativeTextButton::GetPreferredSize(); |
223 // Set minimal width. | 228 // Set minimal width. |
224 if (preferred_size.width() < kButtonMinWidth) | 229 if (preferred_size.width() < kButtonMinWidth) |
225 preferred_size.set_width(kButtonMinWidth); | 230 preferred_size.set_width(kButtonMinWidth); |
226 return preferred_size; | 231 return preferred_size; |
227 } | 232 } |
228 | 233 |
229 } // namespace login | 234 } // namespace login |
230 | 235 |
231 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |