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/ui/webui/chromeos/login/oobe_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 web_ui()->AddMessageHandler(handler); | 410 web_ui()->AddMessageHandler(handler); |
411 handlers_.push_back(handler); | 411 handlers_.push_back(handler); |
412 } | 412 } |
413 | 413 |
414 void OobeUI::InitializeHandlers() { | 414 void OobeUI::InitializeHandlers() { |
415 ready_ = true; | 415 ready_ = true; |
416 for (size_t i = 0; i < ready_callbacks_.size(); ++i) | 416 for (size_t i = 0; i < ready_callbacks_.size(); ++i) |
417 ready_callbacks_[i].Run(); | 417 ready_callbacks_[i].Run(); |
418 ready_callbacks_.clear(); | 418 ready_callbacks_.clear(); |
419 | 419 |
420 for (size_t i = 0; i < handlers_.size(); ++i) | 420 // Notify 'initialize' for synchronously loaded screens. |
421 handlers_[i]->InitializeBase(); | 421 for (size_t i = 0; i < handlers_.size(); ++i) { |
| 422 if (handlers_[i]->async_assets_load_id().empty()) |
| 423 handlers_[i]->InitializeBase(); |
| 424 } |
| 425 } |
| 426 |
| 427 void OobeUI::OnScreenAssetsLoaded(const std::string& async_assets_load_id) { |
| 428 DCHECK(!async_assets_load_id.empty()); |
| 429 |
| 430 for (size_t i = 0; i < handlers_.size(); ++i) { |
| 431 if (handlers_[i]->async_assets_load_id() == async_assets_load_id) |
| 432 handlers_[i]->InitializeBase(); |
| 433 } |
422 } | 434 } |
423 | 435 |
424 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { | 436 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
425 if (!ready_) | 437 if (!ready_) |
426 ready_callbacks_.push_back(display_is_ready_callback); | 438 ready_callbacks_.push_back(display_is_ready_callback); |
427 return ready_; | 439 return ready_; |
428 } | 440 } |
429 | 441 |
430 void OobeUI::ShowOobeUI(bool show) { | 442 void OobeUI::ShowOobeUI(bool show) { |
431 core_handler_->ShowOobeUI(show); | 443 core_handler_->ShowOobeUI(show); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 observer_list_, | 484 observer_list_, |
473 OnCurrentScreenChanged(current_screen_, new_screen)); | 485 OnCurrentScreenChanged(current_screen_, new_screen)); |
474 current_screen_ = new_screen; | 486 current_screen_ = new_screen; |
475 } else { | 487 } else { |
476 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()"; | 488 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()"; |
477 current_screen_ = SCREEN_UNKNOWN; | 489 current_screen_ = SCREEN_UNKNOWN; |
478 } | 490 } |
479 } | 491 } |
480 | 492 |
481 } // namespace chromeos | 493 } // namespace chromeos |
OLD | NEW |