OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui_login_display_host.h" | 5 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void WebUILoginDisplayHost::Observe( | 201 void WebUILoginDisplayHost::Observe( |
202 int type, | 202 int type, |
203 const content::NotificationSource& source, | 203 const content::NotificationSource& source, |
204 const content::NotificationDetails& details) { | 204 const content::NotificationDetails& details) { |
205 BaseLoginDisplayHost::Observe(type, source, details); | 205 BaseLoginDisplayHost::Observe(type, source, details); |
206 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { | 206 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { |
207 is_wallpaper_loaded_ = true; | 207 is_wallpaper_loaded_ = true; |
208 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 208 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
209 OnWallpaperBootAnimationFinished(); | 209 OnWallpaperBootAnimationFinished(); |
210 if (waiting_for_wallpaper_load_) { | 210 if (waiting_for_wallpaper_load_) { |
| 211 // StartWizard / StartSignInScreen could be called multiple times through |
| 212 // the lifetime of host. |
| 213 // Make sure that subsequent calls are not postponed. |
| 214 waiting_for_wallpaper_load_ = false; |
211 if (initialize_webui_in_parallel_) | 215 if (initialize_webui_in_parallel_) |
212 ShowWebUI(); | 216 ShowWebUI(); |
213 else | 217 else |
214 StartPostponedWebUI(); | 218 StartPostponedWebUI(); |
215 // StartWizard / StartSignInScreen could be called multiple times through | |
216 // the lifetime of host. | |
217 // Make sure that subsequent calls are not postponed. | |
218 waiting_for_wallpaper_load_ = false; | |
219 } | 219 } |
220 registrar_.Remove(this, | 220 registrar_.Remove(this, |
221 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 221 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
222 content::NotificationService::AllSources()); | 222 content::NotificationService::AllSources()); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 void WebUILoginDisplayHost::LoadURL(const GURL& url) { | 226 void WebUILoginDisplayHost::LoadURL(const GURL& url) { |
227 if (!login_window_) { | 227 if (!login_window_) { |
228 views::Widget::InitParams params( | 228 views::Widget::InitParams params( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 NOTREACHED(); | 314 NOTREACHED(); |
315 return; | 315 return; |
316 } | 316 } |
317 login_window_->Show(); | 317 login_window_->Show(); |
318 login_view_->GetWebContents()->Focus(); | 318 login_view_->GetWebContents()->Focus(); |
319 login_view_->SetStatusAreaVisible(status_area_saved_visibility_); | 319 login_view_->SetStatusAreaVisible(status_area_saved_visibility_); |
320 login_view_->OnPostponedShow(); | 320 login_view_->OnPostponedShow(); |
321 } | 321 } |
322 | 322 |
323 void WebUILoginDisplayHost::StartPostponedWebUI() { | 323 void WebUILoginDisplayHost::StartPostponedWebUI() { |
324 if (!waiting_for_wallpaper_load_ || !is_wallpaper_loaded_) { | 324 if (!is_wallpaper_loaded_) { |
325 NOTREACHED(); | 325 NOTREACHED(); |
326 return; | 326 return; |
327 } | 327 } |
328 | 328 |
329 // Wallpaper has finished loading before StartWizard/StartSignInScreen has | 329 // Wallpaper has finished loading before StartWizard/StartSignInScreen has |
330 // been called. In general this should not happen. | 330 // been called. In general this should not happen. |
331 // Let go through normal code path when one of those will be called. | 331 // Let go through normal code path when one of those will be called. |
332 if (restore_path_ == RESTORE_UNKNOWN) { | 332 if (restore_path_ == RESTORE_UNKNOWN) { |
333 NOTREACHED(); | 333 NOTREACHED(); |
334 return; | 334 return; |
335 } | 335 } |
336 | 336 |
337 switch (restore_path_) { | 337 switch (restore_path_) { |
338 case RESTORE_WIZARD: | 338 case RESTORE_WIZARD: |
339 StartWizard(wizard_first_screen_name_, | 339 StartWizard(wizard_first_screen_name_, |
340 wizard_screen_parameters_.release()); | 340 wizard_screen_parameters_.release()); |
341 break; | 341 break; |
342 case RESTORE_SIGN_IN: | 342 case RESTORE_SIGN_IN: |
343 StartSignInScreen(); | 343 StartSignInScreen(); |
344 break; | 344 break; |
345 default: | 345 default: |
346 NOTREACHED(); | 346 NOTREACHED(); |
347 break; | 347 break; |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 } // namespace chromeos | 351 } // namespace chromeos |
OLD | NEW |